Commit 01453a37 authored by Antenore Gatta's avatar Antenore Gatta

Code beautyfied

parent bf34393e
......@@ -44,10 +44,11 @@ static RemminaPluginService *remmina_plugin_service = NULL;
static SecretSchema remmina_file_secret_schema =
{ "org.remmina.Password", SECRET_SCHEMA_NONE,
{
{ "filename", SECRET_SCHEMA_ATTRIBUTE_STRING },
{ "key", SECRET_SCHEMA_ATTRIBUTE_STRING },
{ NULL, 0 } } };
{
{ "filename", SECRET_SCHEMA_ATTRIBUTE_STRING },
{ "key", SECRET_SCHEMA_ATTRIBUTE_STRING },
{ NULL, 0 }
} };
#ifdef LIBSECRET_VERSION_0_18
......@@ -65,10 +66,8 @@ static void remmina_plugin_glibsecret_unlock_secret_service()
GList *objects, *ul;
gchar* lbl;
if (secretservice && defaultcollection)
{
if (secret_collection_get_locked(defaultcollection))
{
if (secretservice && defaultcollection) {
if (secret_collection_get_locked(defaultcollection)) {
lbl = secret_collection_get_label(defaultcollection);
remmina_plugin_service->log_printf("[glibsecret] requesting unlock of the default '%s' collection\n", lbl);
objects = g_list_append(NULL, defaultcollection);
......@@ -93,16 +92,13 @@ void remmina_plugin_glibsecret_store_password(RemminaFile *remminafile, const gc
path = remmina_plugin_service->file_get_path(remminafile);
s = g_strdup_printf("Remmina: %s - %s", remmina_plugin_service->file_get_string(remminafile, "name"), key);
secret_password_store_sync(&remmina_file_secret_schema, SECRET_COLLECTION_DEFAULT, s, password,
NULL, &r, "filename", path, "key", key, NULL);
NULL, &r, "filename", path, "key", key, NULL);
g_free(s);
if (r == NULL)
{
if (r == NULL) {
remmina_plugin_service->log_printf("[glibsecret] password saved for file %s\n", path);
}
else
{
}else {
remmina_plugin_service->log_printf("[glibsecret] password cannot be saved for file %s\n", path);
g_error_free (r);
g_error_free(r);
}
}
......@@ -119,15 +115,12 @@ remmina_plugin_glibsecret_get_password(RemminaFile *remminafile, const gchar *ke
path = remmina_plugin_service->file_get_path(remminafile);
password = secret_password_lookup_sync(&remmina_file_secret_schema, NULL, &r, "filename", path, "key", key, NULL);
if (r == NULL)
{
if (r == NULL) {
remmina_plugin_service->log_printf("[glibsecret] found password for file %s\n", path);
p = g_strdup(password);
secret_password_free(password);
return p;
}
else
{
}else {
remmina_plugin_service->log_printf("[glibsecret] password cannot be found for file %s\n", path);
return NULL;
}
......@@ -143,20 +136,17 @@ void remmina_plugin_glibsecret_delete_password(RemminaFile *remminafile, const g
path = remmina_plugin_service->file_get_path(remminafile);
secret_password_clear_sync(&remmina_file_secret_schema, NULL, &r, "filename", path, "key", key, NULL);
if (r == NULL)
{
if (r == NULL) {
remmina_plugin_service->log_printf("[glibsecret] password deleted for file %s\n", path);
}
else
{
}else {
remmina_plugin_service->log_printf("[glibsecret] password cannot be deleted for file %s\n", path);
}
}
static RemminaSecretPlugin remmina_plugin_glibsecret =
{ REMMINA_PLUGIN_TYPE_SECRET, "glibsecret", "GNOME libsecret", NULL, VERSION,
{ REMMINA_PLUGIN_TYPE_SECRET, "glibsecret", "GNOME libsecret", NULL, VERSION,
TRUE, remmina_plugin_glibsecret_store_password, remmina_plugin_glibsecret_get_password, remmina_plugin_glibsecret_delete_password };
TRUE, remmina_plugin_glibsecret_store_password, remmina_plugin_glibsecret_get_password, remmina_plugin_glibsecret_delete_password };
G_MODULE_EXPORT gboolean
remmina_plugin_entry(RemminaPluginService *service)
......@@ -165,8 +155,7 @@ remmina_plugin_entry(RemminaPluginService *service)
remmina_plugin_service = service;
if (!service->register_plugin((RemminaPlugin *) &remmina_plugin_glibsecret))
{
if (!service->register_plugin((RemminaPlugin*)&remmina_plugin_glibsecret)) {
return FALSE;
}
......
......@@ -71,8 +71,8 @@ typedef void (*PThreadCleanupFunc)(void*);
#define IDLE_ADD gdk_threads_add_idle
#define TIMEOUT_ADD gdk_threads_add_timeout
#define CANCEL_ASYNC pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS,NULL);pthread_testcancel();
#define CANCEL_DEFER pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED,NULL);
#define CANCEL_ASYNC pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); pthread_testcancel();
#define CANCEL_DEFER pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
#define THREADS_ENTER _Pragma("GCC error \"THREADS_ENTER has been deprecated in Remmina 1.2\"")
#define THREADS_LEAVE _Pragma("GCC error \"THREADS_LEAVE has been deprecated in Remmina 1.2\"")
......@@ -81,21 +81,21 @@ typedef void (*PThreadCleanupFunc)(void*);
#define X_UNIX_SOCKET "/tmp/.X11-unix/X%d"
#define INCLUDE_GET_AVAILABLE_XDISPLAY static gint \
remmina_get_available_xdisplay (void) \
{ \
gint i; \
gint display = 0; \
gchar fn[200]; \
for (i = 1; i < MAX_X_DISPLAY_NUMBER; i++) \
remmina_get_available_xdisplay(void) \
{ \
g_snprintf (fn, sizeof (fn), X_UNIX_SOCKET, i); \
if (!g_file_test (fn, G_FILE_TEST_EXISTS)) \
gint i; \
gint display = 0; \
gchar fn[200]; \
for (i = 1; i < MAX_X_DISPLAY_NUMBER; i++) \
{ \
display = i; \
break; \
g_snprintf(fn, sizeof(fn), X_UNIX_SOCKET, i); \
if (!g_file_test(fn, G_FILE_TEST_EXISTS)) \
{ \
display = i; \
break; \
} \
} \
} \
return display; \
}
return display; \
}
This diff is collapsed.
......@@ -36,14 +36,13 @@
#pragma once
#define GET_PLUGIN_DATA(gp) (RemminaPluginNxData*) g_object_get_data(G_OBJECT(gp), "plugin-data");
#define GET_PLUGIN_DATA(gp) (RemminaPluginNxData*)g_object_get_data(G_OBJECT(gp), "plugin-data");
G_BEGIN_DECLS
#include "nx_session.h"
typedef enum
{
typedef enum {
REMMINA_NX_EVENT_CANCEL,
REMMINA_NX_EVENT_START,
REMMINA_NX_EVENT_RESTORE,
......@@ -51,8 +50,7 @@ typedef enum
REMMINA_NX_EVENT_TERMINATE
} RemminaNXEventType;
typedef struct _RemminaPluginNxData
{
typedef struct _RemminaPluginNxData {
GtkWidget *socket;
gint socket_id;
......
......@@ -76,17 +76,17 @@ static gboolean remmina_get_keytype(const gchar *private_key_file, gint *keytype
/*****/
static const gchar nx_default_private_key[] = "-----BEGIN DSA PRIVATE KEY-----\n"
"MIIBuwIBAAKBgQCXv9AzQXjxvXWC1qu3CdEqskX9YomTfyG865gb4D02ZwWuRU/9\n"
"C3I9/bEWLdaWgJYXIcFJsMCIkmWjjeSZyTmeoypI1iLifTHUxn3b7WNWi8AzKcVF\n"
"aBsBGiljsop9NiD1mEpA0G+nHHrhvTXz7pUvYrsrXcdMyM6rxqn77nbbnwIVALCi\n"
"xFdHZADw5KAVZI7r6QatEkqLAoGBAI4L1TQGFkq5xQ/nIIciW8setAAIyrcWdK/z\n"
"5/ZPeELdq70KDJxoLf81NL/8uIc4PoNyTRJjtT3R4f8Az1TsZWeh2+ReCEJxDWgG\n"
"fbk2YhRqoQTtXPFsI4qvzBWct42WonWqyyb1bPBHk+JmXFscJu5yFQ+JUVNsENpY\n"
"+Gkz3HqTAoGANlgcCuA4wrC+3Cic9CFkqiwO/Rn1vk8dvGuEQqFJ6f6LVfPfRTfa\n"
"QU7TGVLk2CzY4dasrwxJ1f6FsT8DHTNGnxELPKRuLstGrFY/PR7KeafeFZDf+fJ3\n"
"mbX5nxrld3wi5titTnX+8s4IKv29HJguPvOK/SI7cjzA+SqNfD7qEo8CFDIm1xRf\n"
"8xAPsSKs6yZ6j1FNklfu\n"
"-----END DSA PRIVATE KEY-----\n";
"MIIBuwIBAAKBgQCXv9AzQXjxvXWC1qu3CdEqskX9YomTfyG865gb4D02ZwWuRU/9\n"
"C3I9/bEWLdaWgJYXIcFJsMCIkmWjjeSZyTmeoypI1iLifTHUxn3b7WNWi8AzKcVF\n"
"aBsBGiljsop9NiD1mEpA0G+nHHrhvTXz7pUvYrsrXcdMyM6rxqn77nbbnwIVALCi\n"
"xFdHZADw5KAVZI7r6QatEkqLAoGBAI4L1TQGFkq5xQ/nIIciW8setAAIyrcWdK/z\n"
"5/ZPeELdq70KDJxoLf81NL/8uIc4PoNyTRJjtT3R4f8Az1TsZWeh2+ReCEJxDWgG\n"
"fbk2YhRqoQTtXPFsI4qvzBWct42WonWqyyb1bPBHk+JmXFscJu5yFQ+JUVNsENpY\n"
"+Gkz3HqTAoGANlgcCuA4wrC+3Cic9CFkqiwO/Rn1vk8dvGuEQqFJ6f6LVfPfRTfa\n"
"QU7TGVLk2CzY4dasrwxJ1f6FsT8DHTNGnxELPKRuLstGrFY/PR7KeafeFZDf+fJ3\n"
"mbX5nxrld3wi5titTnX+8s4IKv29HJguPvOK/SI7cjzA+SqNfD7qEo8CFDIm1xRf\n"
"8xAPsSKs6yZ6j1FNklfu\n"
"-----END DSA PRIVATE KEY-----\n";
static const gchar nx_hello_server_msg[] = "hello nxserver - version ";
......@@ -208,9 +208,9 @@ static void remmina_nx_session_set_application_error(RemminaNXSession *nx, const
va_list args;
if (nx->error) g_free(nx->error);
va_start (args, fmt);
nx->error = g_strdup_vprintf (fmt, args);
va_end (args);
va_start(args, fmt);
nx->error = g_strdup_vprintf(fmt, args);
va_end(args);
}
gboolean remmina_nx_session_has_error(RemminaNXSession *nx)
......@@ -283,7 +283,7 @@ static gboolean remmina_nx_session_get_response(RemminaNXSession *nx)
return FALSE;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
buffer = buffer_new();
buffer = buffer_new();
len = channel_read_buffer(nx->channel, buffer, len, is_stderr);
G_GNUC_END_IGNORE_DEPRECATIONS
if (len <= 0) {
......@@ -292,7 +292,7 @@ static gboolean remmina_nx_session_get_response(RemminaNXSession *nx)
}
if (len > 0) {
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
g_string_append_len(nx->response, (const gchar*) buffer_get(buffer), len);
g_string_append_len(nx->response, (const gchar*)buffer_get(buffer), len);
G_GNUC_END_IGNORE_DEPRECATIONS
}
......@@ -310,7 +310,7 @@ static void remmina_nx_session_parse_session_list_line(RemminaNXSession *nx, con
gint i;
GtkTreeIter iter;
p1 = (char*) line;
p1 = (char*)line;
while (*p1 == ' ')
p1++;
if (*p1 == '\0')
......@@ -318,7 +318,7 @@ static void remmina_nx_session_parse_session_list_line(RemminaNXSession *nx, con
gtk_list_store_append(nx->session_list, &iter);
p1 = (char*) line;
p1 = (char*)line;
for (i = 0; i < 7; i++) {
p2 = strchr(p1, ' ');
if (!p2)
......@@ -523,18 +523,18 @@ static void remmina_nx_session_send_command(RemminaNXSession *nx, const gchar *c
va_list args;
gchar *cmd;
va_start (args, cmdfmt);
cmd = g_strdup_vprintf (cmdfmt, args);
ssh_channel_write (nx->channel, cmd, strlen (cmd));
va_start(args, cmdfmt);
cmd = g_strdup_vprintf(cmdfmt, args);
ssh_channel_write(nx->channel, cmd, strlen(cmd));
g_free(cmd);
ssh_set_fd_towrite (nx->session);
ssh_channel_write (nx->channel, "\n", 1);
ssh_set_fd_towrite(nx->session);
ssh_channel_write(nx->channel, "\n", 1);
va_end(args);
}
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("__func__");
gint ret;
......@@ -644,9 +644,9 @@ void remmina_nx_session_add_parameter(RemminaNXSession *nx, const gchar *name, c
va_list args;
gchar *value;
va_start (args, valuefmt);
value = g_strdup_vprintf (valuefmt, args);
g_hash_table_insert(nx->session_parameters, g_strdup (name), value);
va_start(args, valuefmt);
value = g_strdup_vprintf(valuefmt, args);
g_hash_table_insert(nx->session_parameters, g_strdup(name), value);
va_end(args);
}
......@@ -659,7 +659,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);
}
......@@ -678,7 +678,7 @@ gboolean remmina_nx_session_list(RemminaNXSession *nx)
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);
G_TYPE_STRING, G_TYPE_STRING);
} else {
gtk_list_store_clear(nx->session_list);
}
......@@ -780,7 +780,7 @@ gboolean remmina_nx_session_terminate(RemminaNXSession *nx)
static gpointer remmina_nx_session_tunnel_main_thread(gpointer data)
{
TRACE_CALL("__func__");
RemminaNXSession *nx = (RemminaNXSession*) data;
RemminaNXSession *nx = (RemminaNXSession*)data;
gchar *ptr;
ssize_t len = 0, lenw = 0;
fd_set set;
......@@ -834,7 +834,7 @@ static gpointer remmina_nx_session_tunnel_main_thread(gpointer data)
for (ptr = buffer, lenw = 0; len > 0; len -= lenw, ptr += lenw) {
ssh_set_fd_towrite(nx->session);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
lenw = channel_write(channels[0], (char*) ptr, len);
lenw = channel_write(channels[0], (char*)ptr, len);
G_GNUC_END_IGNORE_DEPRECATIONS
if (lenw <= 0) {
nx->running = FALSE;
......@@ -861,10 +861,10 @@ static gpointer remmina_nx_session_tunnel_main_thread(gpointer data)
/* Clean up the stderr buffer in case FreeNX send something there */
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
len = channel_read_nonblocking(channels_out[0], buffer, sizeof(buffer), 1);
if (len == SSH_ERROR || len == SSH_EOF) {
nx->running = FALSE;
break;
}
if (len == SSH_ERROR || len == SSH_EOF) {
nx->running = FALSE;
break;
}
G_GNUC_END_IGNORE_DEPRECATIONS
}
}
......@@ -923,7 +923,7 @@ 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;
......@@ -952,12 +952,12 @@ remmina_nx_session_get_proxy_option(RemminaNXSession *nx)
TRACE_CALL("__func__");
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));
(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);
}
}
......@@ -995,7 +995,7 @@ 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]);
......
......@@ -37,8 +37,7 @@
G_BEGIN_DECLS
enum
{
enum {
REMMINA_NX_SESSION_COLUMN_DISPLAY,
REMMINA_NX_SESSION_COLUMN_TYPE,
REMMINA_NX_SESSION_COLUMN_ID,
......@@ -69,7 +68,7 @@ void remmina_nx_session_set_localport(RemminaNXSession *nx, gint localport);
void remmina_nx_session_set_log_callback(RemminaNXSession *nx, RemminaNXLogCallback log_callback);
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);
gboolean remmina_nx_session_login(RemminaNXSession *nx, const gchar *username, const gchar *password);
......
......@@ -44,28 +44,24 @@ static void remmina_nx_session_manager_set_sensitive(RemminaProtocolWidget *gp,
TRACE_CALL("__func__");
RemminaPluginNxData *gpdata = GET_PLUGIN_DATA(gp);
if (gpdata->attach_session)
{
if (gpdata->attach_session) {
gtk_dialog_set_response_sensitive(GTK_DIALOG(gpdata->manager_dialog), REMMINA_NX_EVENT_TERMINATE, sensitive);
gtk_dialog_set_response_sensitive(GTK_DIALOG(gpdata->manager_dialog), REMMINA_NX_EVENT_ATTACH, sensitive);
}
else
{
}else {
gtk_dialog_set_response_sensitive(GTK_DIALOG(gpdata->manager_dialog), REMMINA_NX_EVENT_TERMINATE, sensitive);
gtk_dialog_set_response_sensitive(GTK_DIALOG(gpdata->manager_dialog), REMMINA_NX_EVENT_RESTORE, sensitive);
}
}
static gboolean remmina_nx_session_manager_selection_func(GtkTreeSelection *selection, GtkTreeModel *model, GtkTreePath *path,
gboolean path_currently_selected, gpointer user_data)
gboolean path_currently_selected, gpointer user_data)
{
TRACE_CALL("__func__");
RemminaProtocolWidget *gp = (RemminaProtocolWidget*) user_data;
RemminaProtocolWidget *gp = (RemminaProtocolWidget*)user_data;
RemminaPluginNxData *gpdata = GET_PLUGIN_DATA(gp);
gpdata->manager_selected = FALSE;
if (path_currently_selected)
{
if (path_currently_selected) {
remmina_nx_session_manager_set_sensitive(gp, FALSE);
return TRUE;
}
......@@ -80,10 +76,9 @@ static gboolean remmina_nx_session_manager_selection_func(GtkTreeSelection *sele
static void remmina_nx_session_manager_send_signal(RemminaPluginNxData *gpdata, gint event_type)
{
TRACE_CALL("__func__");
guchar dummy = (guchar) event_type;
guchar dummy = (guchar)event_type;
/* Signal the NX thread to resume execution */
if (write(gpdata->event_pipe[1], &dummy, 1))
{
if (write(gpdata->event_pipe[1], &dummy, 1)) {
}
}
......@@ -94,25 +89,19 @@ static void remmina_nx_session_manager_on_response(GtkWidget *dialog, gint respo
gint event_type;
remmina_nx_session_manager_set_sensitive(gp, FALSE);
if (response_id <= 0)
{
if (response_id <= 0) {
event_type = REMMINA_NX_EVENT_CANCEL;
}
else
{
}else {
event_type = response_id;
}
if (response_id == REMMINA_NX_EVENT_TERMINATE && gpdata->manager_selected)
{
if (response_id == REMMINA_NX_EVENT_TERMINATE && gpdata->manager_selected) {
remmina_nx_session_iter_set(gpdata->nx, &gpdata->iter, REMMINA_NX_SESSION_COLUMN_STATUS, _("Terminating"));
}
if (response_id != REMMINA_NX_EVENT_TERMINATE)
{
if (response_id != REMMINA_NX_EVENT_TERMINATE) {
gtk_widget_destroy(dialog);
gpdata->manager_dialog = NULL;
}
if (response_id != REMMINA_NX_EVENT_TERMINATE && response_id != REMMINA_NX_EVENT_CANCEL)
{
if (response_id != REMMINA_NX_EVENT_TERMINATE && response_id != REMMINA_NX_EVENT_CANCEL) {
remmina_plugin_nx_service->protocol_plugin_init_show(gp);
}
remmina_nx_session_manager_send_signal(gpdata, event_type);
......@@ -127,9 +116,8 @@ void remmina_nx_session_manager_on_row_activated(GtkTreeView *tree, GtkTreePath
remmina_plugin_nx_service->log_printf("[NX] Default response_id %d\n",
gpdata->default_response);
if (gpdata->default_response >= 0)
{
gtk_dialog_response(GTK_DIALOG(gpdata->manager_dialog), gpdata->default_response);
if (gpdata->default_response >= 0) {
gtk_dialog_response(GTK_DIALOG(gpdata->manager_dialog), gpdata->default_response);
}
}
......@@ -148,22 +136,18 @@ static gboolean remmina_nx_session_manager_main(RemminaProtocolWidget *gp)
remminafile = remmina_plugin_nx_service->protocol_plugin_get_file(gp);
gpdata->default_response = -1;
if (!gpdata->manager_started)
{
if (!gpdata->manager_started) {
remmina_plugin_nx_service->protocol_plugin_init_hide(gp);
dialog = gtk_dialog_new();
s = g_strdup_printf(_("NX Sessions on %s"), remmina_plugin_nx_service->file_get_string(remminafile, "server"));
gtk_window_set_title(GTK_WINDOW(dialog), s);
g_free(s);
if (gpdata->attach_session)
{
if (gpdata->attach_session) {
gtk_dialog_add_button(GTK_DIALOG(dialog), _("Attach"), REMMINA_NX_EVENT_ATTACH);
/* Set default response id for attach */
gpdata->default_response = REMMINA_NX_EVENT_ATTACH;
}
else
{
}else {
gtk_dialog_add_button(GTK_DIALOG(dialog), _("Restore"), REMMINA_NX_EVENT_RESTORE);
gtk_dialog_add_button(GTK_DIALOG(dialog), _("Start"), REMMINA_NX_EVENT_START);
/* Set default response id for restore */
......@@ -197,53 +181,51 @@ static gboolean remmina_nx_session_manager_main(RemminaProtocolWidget *gp)
renderer = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes(_("Type"), renderer, "text", REMMINA_NX_SESSION_COLUMN_TYPE,
NULL);
NULL);
gtk_tree_view_column_set_resizable(column, TRUE);
gtk_tree_view_column_set_sort_column_id(column, REMMINA_NX_SESSION_COLUMN_TYPE);
gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
renderer = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes(_("Display"), renderer, "text",
REMMINA_NX_SESSION_COLUMN_DISPLAY, NULL);
REMMINA_NX_SESSION_COLUMN_DISPLAY, NULL);
gtk_tree_view_column_set_resizable(column, TRUE);
gtk_tree_view_column_set_sort_column_id(column, REMMINA_NX_SESSION_COLUMN_DISPLAY);
gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
renderer = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes(_("Status"), renderer, "text",
REMMINA_NX_SESSION_COLUMN_STATUS, NULL);
REMMINA_NX_SESSION_COLUMN_STATUS, NULL);
gtk_tree_view_column_set_resizable(column, TRUE);
gtk_tree_view_column_set_sort_column_id(column, REMMINA_NX_SESSION_COLUMN_STATUS);
gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
renderer = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes(_("Name"), renderer, "text", REMMINA_NX_SESSION_COLUMN_NAME,
NULL);
NULL);
gtk_tree_view_column_set_resizable(column, TRUE);
gtk_tree_view_column_set_sort_column_id(column, REMMINA_NX_SESSION_COLUMN_NAME);
gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
gtk_tree_selection_set_select_function(gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)),
remmina_nx_session_manager_selection_func, gp, NULL);
remmina_nx_session_manager_selection_func, gp, NULL);
g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(remmina_nx_session_manager_on_response), gp);
gpdata->manager_started = TRUE;
}
gpdata->manager_selected = FALSE;
if (gpdata->manager_dialog)
{
if (gpdata->manager_dialog) {
remmina_nx_session_manager_set_sensitive(gp, FALSE);
gtk_widget_show(gpdata->manager_dialog);
}
if (remmina_nx_session_has_error(gpdata->nx))
{
if (remmina_nx_session_has_error(gpdata->nx)) {
dialog = gtk_message_dialog_new((gpdata->manager_dialog ? GTK_WINDOW(gpdata->manager_dialog) : NULL),
GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s",
remmina_nx_session_get_error (gpdata->nx));
remmina_nx_session_clear_error (gpdata->nx);
gtk_dialog_run (GTK_DIALOG(dialog));
gtk_widget_destroy (dialog);
remmina_nx_session_manager_send_signal (gpdata, 0);
GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s",
remmina_nx_session_get_error(gpdata->nx));
remmina_nx_session_clear_error(gpdata->nx);
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
remmina_nx_session_manager_send_signal(gpdata, 0);
}
gpdata->session_manager_start_handler = 0;
......@@ -255,9 +237,8 @@ void remmina_nx_session_manager_start(RemminaProtocolWidget *gp)
TRACE_CALL("__func__");
RemminaPluginNxData *gpdata = GET_PLUGIN_DATA(gp);
if (gpdata->session_manager_start_handler == 0)
{
gpdata->session_manager_start_handler = IDLE_ADD((GSourceFunc) remmina_nx_session_manager_main, gp);
if (gpdata->session_manager_start_handler == 0) {
gpdata->session_manager_start_handler = IDLE_ADD((GSourceFunc)remmina_nx_session_manager_main, gp);
}
}
......@@ -43,44 +43,31 @@
void remmina_rdp_OnChannelConnectedEventHandler(rdpContext* context, ChannelConnectedEventArgs* e)
{
rfContext* rfi = (rfContext*) context;
rfContext* rfi = (rfContext*)context;
if (g_strcmp0(e->name, RDPEI_DVC_CHANNEL_NAME) == 0)
{
if (g_strcmp0(e->name, RDPEI_DVC_CHANNEL_NAME) == 0) {
g_print("Unimplemented: channel %s connected but we can't use it\n", e->name);
// xfc->rdpei = (RdpeiClientContext*) e->pInterface;
}
else if (g_strcmp0(e->name, TSMF_DVC_CHANNEL_NAME) == 0)
{
}else if (g_strcmp0(e->name, TSMF_DVC_CHANNEL_NAME) == 0) {
g_print("Unimplemented: channel %s connected but we can't use it\n", e->name);
// xf_tsmf_init(xfc, (TsmfClientContext*) e->pInterface);
}
else if (g_strcmp0(e->name, RDPGFX_DVC_CHANNEL_NAME) == 0)
{
}else if (g_strcmp0(e->name, RDPGFX_DVC_CHANNEL_NAME) == 0) {
g_print("Unimplemented: channel %s connected but we can't use it\n", e->name);
/*
if (settings->SoftwareGdi)
gdi_graphics_pipeline_init(context->gdi, (RdpgfxClientContext*) e->pInterface);
else
xf_graphics_pipeline_init(xfc, (RdpgfxClientContext*) e->pInterface);
*/
}
else if (g_strcmp0(e->name, RAIL_SVC_CHANNEL_NAME) == 0)
{
if (settings->SoftwareGdi)
gdi_graphics_pipeline_init(context->gdi, (RdpgfxClientContext*) e->pInterface);
else
xf_graphics_pipeline_init(xfc, (RdpgfxClientContext*) e->pInterface);
*/
}else if (g_strcmp0(e->name, RAIL_SVC_CHANNEL_NAME) == 0) {
g_print("Unimplemented: channel %s connected but we can't use it\n", e->name);
// xf_rail_init(xfc, (RailClientContext*) e->pInterface);
}
else if (g_strcmp0(e->name, CLIPRDR_SVC_CHANNEL_NAME) == 0)
{
remmina_rdp_cliprdr_init( rfi, (CliprdrClientContext*) e->pInterface);
}
else if (g_strcmp0(e->name, ENCOMSP_SVC_CHANNEL_NAME) == 0)
{
}else if (g_strcmp0(e->name, CLIPRDR_SVC_CHANNEL_NAME) == 0) {
remmina_rdp_cliprdr_init( rfi, (CliprdrClientContext*)e->pInterface);
}else if (g_strcmp0(e->name, ENCOMSP_SVC_CHANNEL_NAME) == 0) {
g_print("Unimplemented: channel %s connected but we can't use it\n", e->name);
// xf_encomsp_init(xfc, (EncomspClientContext*) e->pInterface);
}
else if (g_strcmp0(e->name, DISP_DVC_CHANNEL_NAME) == 0)
{
}else if (g_strcmp0(e->name, DISP_DVC_CHANNEL_NAME) == 0) {
// "disp" channel connected, save its context pointer
rfi->dispcontext = (DispClientContext*)e->pInterface;
// Notify remmina_connection_window to unlock dynres capability
......
This diff is collapsed.
This diff is collapsed.
......@@ -62,97 +62,56 @@ gboolean remmina_rdp_file_import_test(const gchar* from_file)
static void remmina_rdp_file_import_field(RemminaFile* remminafile, const gchar* key, const gchar* value)
{
TRACE_CALL("__func__");
if (g_strcmp0(key, "desktopwidth") == 0)
{
if (g_strcmp0(key, "desktopwidth") == 0) {
remmina_plugin_service->file_set_string(remminafile, "resolution_width", value);
}
else if (g_strcmp0(key, "desktopheight") == 0)
{
}else if (g_strcmp0(key, "desktopheight") == 0) {
remmina_plugin_service->file_set_string(remminafile, "resolution_height", value);
}
else if (g_strcmp0(key, "session bpp") == 0)
{
}else if (g_strcmp0(key, "session bpp") == 0) {
remmina_plugin_service->file_set_string(remminafile, "colordepth", value);
}
else if (g_strcmp0(key, "keyboardhook") == 0)
{
remmina_plugin_service->file_set_int(remminafile, "keyboard_grab", (atoi (value) == 1));
}
else if (g_strcmp0(key, "full address") == 0)
{
}else if (g_strcmp0(key, "keyboardhook") == 0) {
remmina_plugin_service->file_set_int(remminafile, "keyboard_grab", (atoi(value) == 1));
}else if (g_strcmp0(key, "full address") == 0) {
remmina_plugin_service->file_set_string(remminafile, "server", value);