Commit 4bbd5d60 authored by Antenore Gatta's avatar Antenore Gatta

Code cleaning

parent b7ef93b6
This diff is collapsed.
......@@ -49,15 +49,13 @@ 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;
......
This diff is collapsed.
......@@ -47,15 +47,13 @@ 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;
......
This diff is collapsed.
/*
* 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
......@@ -47,15 +47,13 @@ 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);
......@@ -67,13 +65,11 @@ 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,
......@@ -84,13 +80,11 @@ 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,
......@@ -98,8 +92,7 @@ enum
REMMINA_FTP_TASK_N_STATUSES
};
enum
{
enum {
REMMINA_FTP_TASK_COLUMN_TYPE,
REMMINA_FTP_TASK_COLUMN_NAME,
REMMINA_FTP_TASK_COLUMN_SIZE,
......@@ -113,8 +106,7 @@ enum
REMMINA_FTP_TASK_N_COLUMNS
};
typedef struct _RemminaFTPTask
{
typedef struct _RemminaFTPTask {
/* Read-only */
gint type;
gchar *name;
......
......@@ -166,8 +166,7 @@ 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);
......@@ -198,8 +197,7 @@ 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);
......@@ -274,15 +272,12 @@ 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);
}
......@@ -298,8 +293,7 @@ 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));
}
......@@ -312,7 +306,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");
......@@ -363,8 +357,7 @@ 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);
}
......@@ -381,8 +374,7 @@ 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);
......@@ -392,22 +384,18 @@ 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);
}
......@@ -416,12 +404,9 @@ 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);
}
......@@ -429,8 +414,7 @@ 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));
......@@ -532,8 +516,7 @@ 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) {
}
......@@ -639,8 +622,7 @@ 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) {
}
......@@ -665,15 +647,11 @@ 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);
......@@ -683,7 +661,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");
......@@ -738,8 +716,7 @@ 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));
......@@ -837,6 +814,6 @@ gint remmina_init_dialog_serverkey_changed(RemminaInitDialog *dialog, const gcha
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:"));
"or the administrator has changed the key. The new public key fingerprint is:"));
}
......@@ -45,8 +45,7 @@ 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,
......@@ -55,8 +54,7 @@ enum
REMMINA_INIT_MODE_CERTIFICATE
};
typedef struct _RemminaInitDialog
{
typedef struct _RemminaInitDialog {
GtkDialog dialog;
GtkWidget *image;
......@@ -77,8 +75,7 @@ typedef struct _RemminaInitDialog
gchar *clientkey;
} RemminaInitDialog;
typedef struct _RemminaInitDialogClass
{
typedef struct _RemminaInitDialogClass {
GtkDialogClass parent_class;
} RemminaInitDialogClass;
......@@ -91,11 +88,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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment