From b6d07aa73af463a2b5430988c1c8890bb366f9cf Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Tue, 24 Nov 2015 17:05:56 +0100 Subject: [PATCH 01/51] Primary user survey dialog --- remmina/CMakeLists.txt | 2 + remmina/src/remmina_main.c | 3 ++ remmina/src/remmina_survey.c | 72 ++++++++++++++++++++++++++++++++++++ remmina/src/remmina_survey.h | 45 ++++++++++++++++++++++ 4 files changed, 122 insertions(+) create mode 100644 remmina/src/remmina_survey.c create mode 100644 remmina/src/remmina_survey.h diff --git a/remmina/CMakeLists.txt b/remmina/CMakeLists.txt index c100fb6170..602c677866 100644 --- a/remmina/CMakeLists.txt +++ b/remmina/CMakeLists.txt @@ -101,6 +101,8 @@ set(REMMINA_SRCS src/remmina_string_array.h src/remmina_string_list.c src/remmina_string_list.h + src/remmina_survey.c + src/remmina_survey.h src/remmina_widget_pool.c src/remmina_widget_pool.h src/remmina_external_tools.c diff --git a/remmina/src/remmina_main.c b/remmina/src/remmina_main.c index 9d250ea45b..6e9cebb3df 100644 --- a/remmina/src/remmina_main.c +++ b/remmina/src/remmina_main.c @@ -44,6 +44,7 @@ #include "remmina_file_editor.h" #include "remmina_connection_window.h" #include "remmina_about.h" +#include "remmina_survey.h" #include "remmina_pref.h" #include "remmina_pref_dialog.h" #include "remmina_widget_pool.h" @@ -1021,6 +1022,8 @@ static void remmina_main_init(void) { gtk_window_maximize(remminamain->window); } + /* Start the first survey form */ + remmina_survey_on_startup(remminamain->window); /* Add a GtkMenuItem to the Tools menu for each plugin of type REMMINA_PLUGIN_TYPE_TOOL */ remmina_plugin_manager_for_each_plugin(REMMINA_PLUGIN_TYPE_TOOL, remmina_main_add_tool_plugin, remminamain); diff --git a/remmina/src/remmina_survey.c b/remmina/src/remmina_survey.c new file mode 100644 index 0000000000..7dbba3e7fa --- /dev/null +++ b/remmina/src/remmina_survey.c @@ -0,0 +1,72 @@ +/* + * Remmina - The GTK+ Remote Desktop Client + * Copyright (C) 2014-2015 Antenore Gatta + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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, + * Boston, MA 02110-1301, USA. + * + * In addition, as a special exception, the copyright holders give + * permission to link the code of portions of this program with the + * OpenSSL library under certain conditions as described in each + * individual source file, and distribute linked combinations + * including the two. + * You must obey the GNU General Public License in all respects + * for all of the code used other than OpenSSL. + * If you modify file(s) with this exception, you may extend this exception + * to your version of the file(s), but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your + * version. + * If you delete this exception statement from all source + * files in the program, then also delete it here. + * + */ + +#include +#include +#include "remmina_survey.h" +#include "remmina_public.h" +#include "remmina/remmina_trace_calls.h" + +/* Show the preliminary survey dialog when remmina start */ +void remmina_survey_on_startup(GtkWindow *parent) +{ + TRACE_CALL("remmina_survey"); + + GtkWidget *dialog, *check; + + dialog = gtk_message_dialog_new (GTK_WINDOW (parent), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_YES_NO, + "%s", + /* translators: Primary message of a dialog used to notify the user about the survey */ + _("We are conducting a user survey\n would you like to take it now?")); + + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", + /* translators: Secondary text of a dialog used to notify the user about the survey */ + _("If not, you can always find it in the Help menu.")); + + check = gtk_check_button_new_with_mnemonic (_("_Do not show this dialog again")); + gtk_box_pack_end (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), + check, FALSE, FALSE, 0); + gtk_widget_set_halign (check, GTK_ALIGN_START); + gtk_widget_set_margin_start (check, 6); + gtk_widget_show (check); + + printf("Survey\n"); + + g_signal_connect(dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL); + gtk_window_present(GTK_WINDOW(dialog)); +} diff --git a/remmina/src/remmina_survey.h b/remmina/src/remmina_survey.h new file mode 100644 index 0000000000..ec94a2a833 --- /dev/null +++ b/remmina/src/remmina_survey.h @@ -0,0 +1,45 @@ +/* + * Remmina - The GTK+ Remote Desktop Client + * Copyright (C) 2014-2015 Antenore Gatta + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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, + * Boston, MA 02110-1301, USA. + * + * In addition, as a special exception, the copyright holders give + * permission to link the code of portions of this program with the + * OpenSSL library under certain conditions as described in each + * individual source file, and distribute linked combinations + * including the two. + * You must obey the GNU General Public License in all respects + * for all of the code used other than OpenSSL. * If you modify + * file(s) with this exception, you may extend this exception to your + * version of the file(s), but you are not obligated to do so. * If you + * do not wish to do so, delete this exception statement from your + * version. * If you delete this exception statement from all source + * files in the program, then also delete it here. + * + */ + +#ifndef __REMMINASURVEY_H__ +#define __REMMINASURVEY_H__ + +G_BEGIN_DECLS + +void remmina_survey_on_startup(GtkWindow *parent); + +G_END_DECLS + +#endif /* __REMMINASURVEY_H__ */ + From ca464ab9c292ffdcbf6de9a64e88bae3d2ee7dbf Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Tue, 24 Nov 2015 17:27:01 +0100 Subject: [PATCH 02/51] survey checkbox --- remmina/ui/remmina_preferences.glade | 102 ++++++++++++++++----------- 1 file changed, 59 insertions(+), 43 deletions(-) diff --git a/remmina/ui/remmina_preferences.glade b/remmina/ui/remmina_preferences.glade index aa2666f209..4fe26583b4 100644 --- a/remmina/ui/remmina_preferences.glade +++ b/remmina/ui/remmina_preferences.glade @@ -100,12 +100,12 @@ True False - Double-click action 0 + Double-click action 0 - 2 + 3 @@ -120,7 +120,7 @@ 1 - 2 + 3 2 @@ -128,12 +128,12 @@ True False - Scale quality 0 + Scale quality 0 - 3 + 4 @@ -150,7 +150,7 @@ 1 - 3 + 4 2 @@ -158,12 +158,12 @@ True False - SSH tunnel local port 0 + SSH tunnel local port 0 - 4 + 5 @@ -174,7 +174,7 @@ 1 - 4 + 5 2 @@ -182,12 +182,12 @@ True False - Auto scroll step size 0 + Auto scroll step size 0 - 7 + 9 @@ -198,7 +198,7 @@ 1 - 7 + 9 2 @@ -206,8 +206,8 @@ True False - Maximum recent items 0 + Maximum recent items 0 @@ -243,12 +243,12 @@ True False - Resolutions 0 + Resolutions 0 - 9 + 10 @@ -261,7 +261,7 @@ 1 - 9 + 10 2 @@ -269,12 +269,12 @@ True False - Keystrokes 0 + Keystrokes 0 - 10 + 11 @@ -287,7 +287,7 @@ 1 - 10 + 11 2 @@ -302,7 +302,7 @@ 0 - 6 + 7 3 @@ -321,7 +321,7 @@ 1 - 5 + 6 2 @@ -329,12 +329,28 @@ True False + 0 SSH log level + + + 0 + 6 + + + + + Activate survey dialog on startup + True + True + False 0 + True + True 0 - 5 + 2 + 3 @@ -414,8 +430,8 @@ True False - Default view mode 0 + Default view mode 0 @@ -444,8 +460,8 @@ True False - Tab interface 0 + Tab interface 0 @@ -474,8 +490,8 @@ True False - Show buttons icons 0 + Show buttons icons 0 @@ -504,8 +520,8 @@ True False - Show menu icons 0 + Show menu icons 0 @@ -664,8 +680,8 @@ True False True - Host key 0 + Host key 0 @@ -692,8 +708,8 @@ True False True - Toggle fullscreen mode 0 + Toggle fullscreen mode 0 @@ -720,8 +736,8 @@ True False True - Auto-fit window 0 + Auto-fit window 0 @@ -748,8 +764,8 @@ True False True - Switch tab pages 0 + Switch tab pages 0 @@ -789,8 +805,8 @@ True False True - Toggle scaled mode 0 + Toggle scaled mode 0 @@ -817,8 +833,8 @@ True False True - Grab keyboard 0 + Grab keyboard 0 @@ -845,8 +861,8 @@ True False True - Minimize window 0 + Minimize window 0 @@ -873,8 +889,8 @@ True False True - Disconnect 0 + Disconnect 0 @@ -901,8 +917,8 @@ True False True - Show / hide toolbar 0 + Show / hide toolbar 0 @@ -961,8 +977,8 @@ True False True - Font 0 + Font 0 @@ -974,8 +990,8 @@ True False True - Colors 0 + Colors 0 @@ -987,8 +1003,8 @@ True False True - Foreground color 0 + Foreground color 0 @@ -1000,8 +1016,8 @@ True False True - Background color 0 + Background color 0 @@ -1013,8 +1029,8 @@ True False True - Scrollback lines 0 + Scrollback lines 0 @@ -1026,8 +1042,8 @@ True False True - Keyboard 0 + Keyboard 0 @@ -1176,8 +1192,8 @@ True False True - Copy 0 + Copy 1 @@ -1215,8 +1231,8 @@ True False True - Paste 0 + Paste 1 From 0bccb77f1a64b4ed884c25662a71c31d5e9c45b2 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Tue, 24 Nov 2015 17:38:11 +0100 Subject: [PATCH 03/51] cleaning up --- remmina/src/remmina_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/remmina/src/remmina_main.c b/remmina/src/remmina_main.c index 6e9cebb3df..ba88a8f669 100644 --- a/remmina/src/remmina_main.c +++ b/remmina/src/remmina_main.c @@ -1022,7 +1022,7 @@ static void remmina_main_init(void) { gtk_window_maximize(remminamain->window); } - /* Start the first survey form */ + /* Dialog message used to notify the user about the survey */ remmina_survey_on_startup(remminamain->window); /* Add a GtkMenuItem to the Tools menu for each plugin of type REMMINA_PLUGIN_TYPE_TOOL */ remmina_plugin_manager_for_each_plugin(REMMINA_PLUGIN_TYPE_TOOL, remmina_main_add_tool_plugin, remminamain); From 6f943ac8f86cb9cd4589a652ff198acbc61dda7b Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Wed, 25 Nov 2015 01:17:36 +0100 Subject: [PATCH 04/51] User survey preliminary dialog --- remmina/src/remmina_connection_window.c | 25 ++++++----- remmina/src/remmina_main.c | 14 +++++- remmina/src/remmina_main.h | 1 + remmina/src/remmina_pref.c | 12 +++++ remmina/src/remmina_pref.h | 3 ++ remmina/src/remmina_pref_dialog.c | 3 ++ remmina/src/remmina_pref_dialog.h | 1 + remmina/src/remmina_survey.c | 59 ++++++++++++++++--------- remmina/src/remmina_survey.h | 1 + remmina/ui/remmina_main.glade | 16 +++++++ remmina/ui/remmina_preferences.glade | 1 - 11 files changed, 102 insertions(+), 34 deletions(-) diff --git a/remmina/src/remmina_connection_window.c b/remmina/src/remmina_connection_window.c index 137af6b885..97b7a11414 100644 --- a/remmina/src/remmina_connection_window.c +++ b/remmina/src/remmina_connection_window.c @@ -2383,9 +2383,11 @@ static void remmina_connection_window_initialize_notebook(GtkNotebook* to, GtkNo tab = remmina_connection_object_create_tab(cnnobj); remmina_connection_object_append_page(cnnobj, to, tab, view_mode); - G_GNUC_BEGIN_IGNORE_DEPRECATIONS - gtk_widget_reparent(cnnobj->viewport, cnnobj->scrolled_container); - G_GNUC_END_IGNORE_DEPRECATIONS + /* Reparent cnnobj->viewport */ + g_object_ref(cnnobj->viewport); + gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(cnnobj->viewport)), cnnobj->viewport); + gtk_container_add(GTK_CONTAINER(cnnobj->scrolled_container), cnnobj->viewport ); + g_object_unref(cnnobj->viewport); if (cnnobj->window) { @@ -2408,10 +2410,11 @@ static void remmina_connection_window_initialize_notebook(GtkNotebook* to, GtkNo tab = remmina_connection_object_create_tab(tc); remmina_connection_object_append_page(tc, to, tab, view_mode); - /* Reparent cnnobj->viewport */ - G_GNUC_BEGIN_IGNORE_DEPRECATIONS - gtk_widget_reparent(tc->viewport, tc->scrolled_container); - G_GNUC_END_IGNORE_DEPRECATIONS + /* Reparent tc->viewport */ + g_object_ref(tc->viewport); + gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(tc->viewport)),tc->viewport); + gtk_container_add(GTK_CONTAINER(tc->scrolled_container), tc->viewport ); + g_object_unref(tc->viewport); } gtk_notebook_set_current_page(to, c); } @@ -3142,9 +3145,11 @@ static void remmina_connection_object_on_connect(RemminaProtocolWidget* gp, Remm 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); - G_GNUC_BEGIN_IGNORE_DEPRECATIONS - gtk_widget_reparent(cnnobj->viewport, cnnobj->scrolled_container); - G_GNUC_END_IGNORE_DEPRECATIONS + /* Reparent cnnobj->viewport */ + g_object_ref(cnnobj->viewport); + gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(cnnobj->viewport)), cnnobj->viewport); + gtk_container_add(GTK_CONTAINER(cnnobj->scrolled_container), cnnobj->viewport ); + g_object_unref(cnnobj->viewport); gtk_window_present(GTK_WINDOW(cnnhld->cnnwin)); gtk_notebook_set_current_page(GTK_NOTEBOOK(cnnhld->cnnwin->priv->notebook), i); diff --git a/remmina/src/remmina_main.c b/remmina/src/remmina_main.c index ba88a8f669..542195eb48 100644 --- a/remmina/src/remmina_main.c +++ b/remmina/src/remmina_main.c @@ -876,6 +876,12 @@ void remmina_main_on_action_help_debug(GtkAction *action, gpointer user_data) remmina_log_start(); } +void remmina_main_on_action_help_survey(GtkAction *action, gpointer user_data) +{ + TRACE_CALL("remmina_main_on_action_help_survey"); + remmina_survey_start(); +} + void remmina_main_on_action_application_about(GtkAction *action, gpointer user_data) { TRACE_CALL("remmina_main_on_action_application_about"); @@ -1022,8 +1028,7 @@ static void remmina_main_init(void) { gtk_window_maximize(remminamain->window); } - /* Dialog message used to notify the user about the survey */ - remmina_survey_on_startup(remminamain->window); + /* Add a GtkMenuItem to the Tools menu for each plugin of type REMMINA_PLUGIN_TYPE_TOOL */ remmina_plugin_manager_for_each_plugin(REMMINA_PLUGIN_TYPE_TOOL, remmina_main_add_tool_plugin, remminamain); @@ -1092,6 +1097,10 @@ static void remmina_main_init(void) /* Register the window in remmina_widget_pool with GType=GTK_WINDOW and TAG=remmina-main-window */ g_object_set_data(G_OBJECT(remminamain->window), "tag", "remmina-main-window"); remmina_widget_pool_register(GTK_WIDGET(remminamain->window)); + /* Dialog message used to notify the user about the survey */ + if (remmina_pref.survey) { + remmina_survey_on_startup(remminamain->window); + } } /* RemminaMain instance */ @@ -1154,6 +1163,7 @@ GtkWidget* remmina_main_new(void) remminamain->action_help_homepage = GTK_ACTION(GET_OBJECT("action_help_homepage")); remminamain->action_help_wiki = GTK_ACTION(GET_OBJECT("action_help_wiki")); remminamain->action_help_debug = GTK_ACTION(GET_OBJECT("action_help_debug")); + remminamain->action_help_survey = GTK_ACTION(GET_OBJECT("action_help_survey")); G_GNUC_END_IGNORE_DEPRECATIONS /* Connect signals */ gtk_builder_connect_signals(remminamain->builder, NULL); diff --git a/remmina/src/remmina_main.h b/remmina/src/remmina_main.h index 991112d4e0..80b2bc189a 100644 --- a/remmina/src/remmina_main.h +++ b/remmina/src/remmina_main.h @@ -94,6 +94,7 @@ typedef struct _RemminaMain GtkAction *action_help_homepage; GtkAction *action_help_wiki; GtkAction *action_help_debug; + GtkAction *action_help_survey; RemminaMainPriv *priv; } RemminaMain; diff --git a/remmina/src/remmina_pref.c b/remmina/src/remmina_pref.c index 74e4acd715..748de1fc56 100644 --- a/remmina/src/remmina_pref.c +++ b/remmina/src/remmina_pref.c @@ -195,6 +195,11 @@ void remmina_pref_init(void) else remmina_pref.save_when_connect = TRUE; + if (g_key_file_has_key(gkeyfile, "remmina_pref", "survey", NULL)) + remmina_pref.survey = g_key_file_get_boolean(gkeyfile, "remmina_pref", "survey", NULL); + else + remmina_pref.survey = TRUE; + if (g_key_file_has_key(gkeyfile, "remmina_pref", "invisible_toolbar", NULL)) remmina_pref.invisible_toolbar = g_key_file_get_boolean(gkeyfile, "remmina_pref", "invisible_toolbar", NULL); else @@ -511,6 +516,7 @@ void remmina_pref_save(void) g_key_file_set_boolean(gkeyfile, "remmina_pref", "save_view_mode", remmina_pref.save_view_mode); g_key_file_set_boolean(gkeyfile, "remmina_pref", "save_when_connect", remmina_pref.save_when_connect); + g_key_file_set_boolean(gkeyfile, "remmina_pref", "survey", remmina_pref.survey); g_key_file_set_boolean(gkeyfile, "remmina_pref", "invisible_toolbar", remmina_pref.invisible_toolbar); g_key_file_set_integer(gkeyfile, "remmina_pref", "floating_toolbar_placement", remmina_pref.floating_toolbar_placement); g_key_file_set_integer(gkeyfile, "remmina_pref", "toolbar_placement", remmina_pref.toolbar_placement); @@ -725,6 +731,12 @@ gint remmina_pref_get_ssh_loglevel(void) return remmina_pref.ssh_loglevel; } +gboolean remmina_pref_get_survey(void) +{ + TRACE_CALL("remmina_pref_get_survey"); + return remmina_pref.survey; +} + gboolean remmina_pref_get_ssh_parseconfig(void) { TRACE_CALL("remmina_pref_get_ssh_parseconfig"); diff --git a/remmina/src/remmina_pref.h b/remmina/src/remmina_pref.h index 1bfc6baec0..1568c2000a 100644 --- a/remmina/src/remmina_pref.h +++ b/remmina/src/remmina_pref.h @@ -90,6 +90,7 @@ typedef struct _RemminaPref /* In RemminaPrefDialog options tab */ gboolean save_view_mode; gboolean save_when_connect; + gboolean survey; gint default_action; gint scale_quality; gint ssh_loglevel; @@ -167,6 +168,8 @@ extern RemminaPref remmina_pref; void remmina_pref_init(void); void remmina_pref_save(void); +gboolean remmina_pref_get_survey(void); + void remmina_pref_add_recent(const gchar *protocol, const gchar *server); gchar* remmina_pref_get_recent(const gchar *protocol); void remmina_pref_clear_recent(void); diff --git a/remmina/src/remmina_pref_dialog.c b/remmina/src/remmina_pref_dialog.c index a49f341641..64ef5b89b3 100644 --- a/remmina/src/remmina_pref_dialog.c +++ b/remmina/src/remmina_pref_dialog.c @@ -121,6 +121,7 @@ void remmina_pref_on_dialog_destroy(GtkWidget *widget, gpointer user_data) remmina_pref.save_view_mode = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_options_remember_last_view_mode)); remmina_pref.save_when_connect = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_options_save_settings)); + remmina_pref.survey = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_options_survey)); remmina_pref.invisible_toolbar = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_appearance_invisible_toolbar)); remmina_pref.always_show_tab = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_appearance_show_tabs)); remmina_pref.hide_connection_toolbar = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_appearance_hide_toolbar)); @@ -267,6 +268,7 @@ static void remmina_pref_dialog_init(void) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_options_remember_last_view_mode), remmina_pref.save_view_mode); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_options_save_settings), remmina_pref.save_when_connect); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_options_survey), remmina_pref.survey); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_appearance_invisible_toolbar), remmina_pref.invisible_toolbar); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_appearance_show_tabs), remmina_pref.always_show_tab); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_appearance_hide_toolbar), remmina_pref.hide_connection_toolbar); @@ -366,6 +368,7 @@ GtkDialog* remmina_pref_dialog_new(gint default_tab, GtkWindow *parent) remmina_pref_dialog->checkbutton_options_remember_last_view_mode = GTK_CHECK_BUTTON(GET_OBJECT("checkbutton_options_remember_last_view_mode")); remmina_pref_dialog->checkbutton_options_save_settings = GTK_CHECK_BUTTON(GET_OBJECT("checkbutton_options_save_settings")); + remmina_pref_dialog->checkbutton_options_survey = GTK_CHECK_BUTTON(GET_OBJECT("checkbutton_options_survey")); remmina_pref_dialog->checkbutton_appearance_invisible_toolbar = GTK_CHECK_BUTTON(GET_OBJECT("checkbutton_appearance_invisible_toolbar")); remmina_pref_dialog->checkbutton_appearance_show_tabs = GTK_CHECK_BUTTON(GET_OBJECT("checkbutton_appearance_show_tabs")); remmina_pref_dialog->checkbutton_appearance_hide_toolbar = GTK_CHECK_BUTTON(GET_OBJECT("checkbutton_appearance_hide_toolbar")); diff --git a/remmina/src/remmina_pref_dialog.h b/remmina/src/remmina_pref_dialog.h index ade01cf18b..3fd3c3629c 100644 --- a/remmina/src/remmina_pref_dialog.h +++ b/remmina/src/remmina_pref_dialog.h @@ -52,6 +52,7 @@ typedef struct _RemminaPrefDialog GtkCheckButton *checkbutton_options_remember_last_view_mode; GtkCheckButton *checkbutton_options_save_settings; + GtkCheckButton *checkbutton_options_survey; GtkCheckButton *checkbutton_appearance_invisible_toolbar; GtkCheckButton *checkbutton_appearance_show_tabs; GtkCheckButton *checkbutton_appearance_hide_toolbar; diff --git a/remmina/src/remmina_survey.c b/remmina/src/remmina_survey.c index 7dbba3e7fa..fd3fcf4269 100644 --- a/remmina/src/remmina_survey.c +++ b/remmina/src/remmina_survey.c @@ -36,37 +36,54 @@ #include #include #include "remmina_survey.h" +#include "remmina_pref.h" #include "remmina_public.h" #include "remmina/remmina_trace_calls.h" /* Show the preliminary survey dialog when remmina start */ void remmina_survey_on_startup(GtkWindow *parent) { - TRACE_CALL("remmina_survey"); + TRACE_CALL("remmina_survey"); - GtkWidget *dialog, *check; + GtkWidget *dialog, *check; - dialog = gtk_message_dialog_new (GTK_WINDOW (parent), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_QUESTION, - GTK_BUTTONS_YES_NO, - "%s", - /* translators: Primary message of a dialog used to notify the user about the survey */ - _("We are conducting a user survey\n would you like to take it now?")); + dialog = gtk_message_dialog_new(GTK_WINDOW (parent), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_YES_NO, + "%s", + /* translators: Primary message of a dialog used to notify the user about the survey */ + _("We are conducting a user survey\n would you like to take it now?")); - gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", - /* translators: Secondary text of a dialog used to notify the user about the survey */ - _("If not, you can always find it in the Help menu.")); + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", + /* translators: Secondary text of a dialog used to notify the user about the survey */ + _("If not, you can always find it in the Help menu.")); - check = gtk_check_button_new_with_mnemonic (_("_Do not show this dialog again")); - gtk_box_pack_end (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), - check, FALSE, FALSE, 0); - gtk_widget_set_halign (check, GTK_ALIGN_START); - gtk_widget_set_margin_start (check, 6); - gtk_widget_show (check); + check = gtk_check_button_new_with_mnemonic (_("_Do not show this dialog again")); + gtk_box_pack_end (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), + check, FALSE, FALSE, 0); + gtk_widget_set_halign (check, GTK_ALIGN_START); + gtk_widget_set_margin_start (check, 6); + gtk_widget_show (check); - printf("Survey\n"); + if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES) + { + remmina_survey_start(); + } - g_signal_connect(dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL); - gtk_window_present(GTK_WINDOW(dialog)); + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check))) + { + /* Save survey option */ + remmina_pref.survey = FALSE; + remmina_pref_save(); + } + + gtk_widget_destroy(dialog); + //g_signal_connect(dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL); + //gtk_window_present(GTK_WINDOW(dialog)); +} + +void remmina_survey_start() +{ + TRACE_CALL("remmina_survey_start"); } diff --git a/remmina/src/remmina_survey.h b/remmina/src/remmina_survey.h index ec94a2a833..f25661efbb 100644 --- a/remmina/src/remmina_survey.h +++ b/remmina/src/remmina_survey.h @@ -38,6 +38,7 @@ G_BEGIN_DECLS void remmina_survey_on_startup(GtkWindow *parent); +void remmina_survey_start(); G_END_DECLS diff --git a/remmina/ui/remmina_main.glade b/remmina/ui/remmina_main.glade index eca119f833..4c4485e65d 100644 --- a/remmina/ui/remmina_main.glade +++ b/remmina/ui/remmina_main.glade @@ -130,6 +130,13 @@ + + + Survey + Survey + + + accelgroup_shortcuts @@ -537,6 +544,15 @@ True + + + action_help_survey + True + False + Survey + True + + True diff --git a/remmina/ui/remmina_preferences.glade b/remmina/ui/remmina_preferences.glade index 4fe26583b4..b5234f6055 100644 --- a/remmina/ui/remmina_preferences.glade +++ b/remmina/ui/remmina_preferences.glade @@ -344,7 +344,6 @@ True False 0 - True True From 90a82cc7114b79cfc3032707e6526e74d24f3382 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Wed, 25 Nov 2015 02:21:53 +0100 Subject: [PATCH 05/51] Survey container --- remmina/src/remmina_main.c | 2 +- remmina/src/remmina_survey.c | 17 ++++- remmina/ui/CMakeLists.txt | 1 + remmina/ui/remmina_survey.glade | 120 ++++++++++++++++++++++++++++++++ 4 files changed, 137 insertions(+), 3 deletions(-) create mode 100644 remmina/ui/remmina_survey.glade diff --git a/remmina/src/remmina_main.c b/remmina/src/remmina_main.c index 542195eb48..f99fc08013 100644 --- a/remmina/src/remmina_main.c +++ b/remmina/src/remmina_main.c @@ -879,7 +879,7 @@ void remmina_main_on_action_help_debug(GtkAction *action, gpointer user_data) void remmina_main_on_action_help_survey(GtkAction *action, gpointer user_data) { TRACE_CALL("remmina_main_on_action_help_survey"); - remmina_survey_start(); + remmina_survey_start(remminamain->window); } void remmina_main_on_action_application_about(GtkAction *action, gpointer user_data) diff --git a/remmina/src/remmina_survey.c b/remmina/src/remmina_survey.c index fd3fcf4269..83cc4ed2a9 100644 --- a/remmina/src/remmina_survey.c +++ b/remmina/src/remmina_survey.c @@ -68,7 +68,7 @@ void remmina_survey_on_startup(GtkWindow *parent) if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES) { - remmina_survey_start(); + remmina_survey_start(parent); } if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check))) @@ -83,7 +83,20 @@ void remmina_survey_on_startup(GtkWindow *parent) //gtk_window_present(GTK_WINDOW(dialog)); } -void remmina_survey_start() +void remmina_survey_start(GtkWindow *parent) { TRACE_CALL("remmina_survey_start"); + GtkBuilder *builder = remmina_public_gtk_builder_new_from_file("remmina_survey.glade"); + GtkDialog *dialog = GTK_DIALOG (gtk_builder_get_object(builder, "dialog_remmina_survey")); + + if (parent) + { + gtk_window_set_transient_for(GTK_WINDOW(dialog), parent); + gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE); + } + + g_signal_connect(dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL); + gtk_window_present(GTK_WINDOW(dialog)); + + g_object_unref(G_OBJECT(builder)); } diff --git a/remmina/ui/CMakeLists.txt b/remmina/ui/CMakeLists.txt index 0bde138101..b3772cb533 100644 --- a/remmina/ui/CMakeLists.txt +++ b/remmina/ui/CMakeLists.txt @@ -32,6 +32,7 @@ install(FILES remmina_about.glade DESTINATION "${REMMINA_UIDIR}") +install(FILES remmina_survey.glade DESTINATION "${REMMINA_UIDIR}") install(FILES remmina_main.glade DESTINATION "${REMMINA_UIDIR}") install(FILES remmina_spinner.glade DESTINATION "${REMMINA_UIDIR}") install(FILES remmina_preferences.glade DESTINATION "${REMMINA_UIDIR}") diff --git a/remmina/ui/remmina_survey.glade b/remmina/ui/remmina_survey.glade new file mode 100644 index 0000000000..35eb29730b --- /dev/null +++ b/remmina/ui/remmina_survey.glade @@ -0,0 +1,120 @@ + + + + + + + + + False + Remmina User Survey + 512 + 640 + dialog + + + False + vertical + 2 + + + False + end + + + gtk-cancel + True + True + True + True + + + True + True + 0 + + + + + gtk-ok + True + True + True + True + + + True + True + 1 + + + + + False + True + end + 2 + + + + + True + False + vertical + + + + + + True + True + never + 480 + + + True + False + + + + + + + + True + True + 2 + + + + + False + True + 1 + + + + + + From 2aad1e4883912daf6bc8040de36c42d0e216cb8f Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Wed, 25 Nov 2015 17:15:28 +0100 Subject: [PATCH 06/51] Remmina survey webkit implmentation --- CMakeLists.txt | 6 ++++++ config.h.in | 2 ++ remmina/CMakeLists.txt | 4 ++++ remmina/src/remmina_survey.c | 17 ++++++++++++++++- remmina/ui/remmina_survey.glade | 27 ++++++++++++++++++--------- 5 files changed, 46 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e08c294c22..f3068607f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,6 +107,7 @@ set(REMMINA_LOCALEDIR "${CMAKE_INSTALL_FULL_DATADIR}/locale") set(REMMINA_PLUGINDIR "${CMAKE_INSTALL_FULL_LIBDIR}/remmina/plugins") set(REMMINA_UIDIR "${CMAKE_INSTALL_FULL_DATADIR}/remmina/ui") + # Uninstall support configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" @@ -120,6 +121,11 @@ find_required_package(PTHREAD) find_suggested_package(GCRYPT) find_suggested_package(AVAHI) +IF (NOT DEFINED REMMINA_SURVEY_URI) + SET(REMMINA_SURVEY_URI "http://www.remmina.org/") +ENDIF() +ADD_DEFINITIONS(-DREMMINA_SURVEY_URI=${REMMINA_SURVEY_URI}) + if(WITH_TRACE_CALLS) message(STATUS "Enabling trace calls.") add_definitions(-DWITH_TRACE_CALLS) diff --git a/config.h.in b/config.h.in index b29fd17ceb..385d47ed6d 100644 --- a/config.h.in +++ b/config.h.in @@ -23,4 +23,6 @@ #define REMMINA_PLUGINDIR "${REMMINA_PLUGINDIR}" #define REMMINA_UIDIR "${REMMINA_UIDIR}" +#define REMMINA_SURVEY_URI "${REMMINA_SURVEY_URI}" + #endif diff --git a/remmina/CMakeLists.txt b/remmina/CMakeLists.txt index 602c677866..93808a406e 100644 --- a/remmina/CMakeLists.txt +++ b/remmina/CMakeLists.txt @@ -114,6 +114,10 @@ add_executable(remmina ${REMMINA_SRCS}) include_directories(${GTK_INCLUDE_DIRS}) target_link_libraries(remmina ${GTK_LIBRARIES}) +pkg_check_modules(WEBKIT REQUIRED webkitgtk-3.0) +target_link_libraries(remmina ${WEBKIT_LIBRARIES}) +include_directories(${WEBKIT_INCLUDE_DIRS}) + find_package(X11) include_directories(${X11_INCLUDE_DIR}) target_link_libraries(remmina ${X11_LIBRARIES}) diff --git a/remmina/src/remmina_survey.c b/remmina/src/remmina_survey.c index 83cc4ed2a9..a6e3c6bf85 100644 --- a/remmina/src/remmina_survey.c +++ b/remmina/src/remmina_survey.c @@ -35,11 +35,19 @@ #include #include +#include +#include +#include +#include "config.h" #include "remmina_survey.h" #include "remmina_pref.h" #include "remmina_public.h" #include "remmina/remmina_trace_calls.h" +static gchar* survey_uri = REMMINA_SURVEY_URI; + +static WebKitWebView* web_view; + /* Show the preliminary survey dialog when remmina start */ void remmina_survey_on_startup(GtkWindow *parent) { @@ -87,7 +95,11 @@ void remmina_survey_start(GtkWindow *parent) { TRACE_CALL("remmina_survey_start"); GtkBuilder *builder = remmina_public_gtk_builder_new_from_file("remmina_survey.glade"); - GtkDialog *dialog = GTK_DIALOG (gtk_builder_get_object(builder, "dialog_remmina_survey")); + GtkDialog *dialog + = GTK_DIALOG (gtk_builder_get_object(builder, "dialog_remmina_survey")); + GtkScrolledWindow *scrolledwindow + = GTK_SCROLLED_WINDOW (gtk_builder_get_object(builder, "scrolledwindow")); + web_view = WEBKIT_WEB_VIEW(webkit_web_view_new()); if (parent) { @@ -98,5 +110,8 @@ void remmina_survey_start(GtkWindow *parent) g_signal_connect(dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL); gtk_window_present(GTK_WINDOW(dialog)); + gtk_container_add(GTK_CONTAINER(scrolledwindow), GTK_WIDGET(web_view)); + gtk_widget_show(GTK_WIDGET(web_view)); + webkit_web_view_load_uri(web_view, survey_uri); g_object_unref(G_OBJECT(builder)); } diff --git a/remmina/ui/remmina_survey.glade b/remmina/ui/remmina_survey.glade index 35eb29730b..9d9dec57c3 100644 --- a/remmina/ui/remmina_survey.glade +++ b/remmina/ui/remmina_survey.glade @@ -1,5 +1,5 @@ - + + + + Close + gtk-close + + + + + + Submit + gtk-ok + + + + False Remmina User Survey @@ -44,6 +60,8 @@ Author: Antenore Gatta gtk-cancel + True + action_survey_close True True True @@ -58,10 +76,13 @@ Author: Antenore Gatta gtk-ok + True + action_survey_submit True True True True + 0.56000000238418579 True From 18a85f6116622b52c484d994376a4ef6cffacfff Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Wed, 25 Nov 2015 21:54:25 +0100 Subject: [PATCH 09/51] Signal connection --- remmina/src/remmina_survey.c | 3 +++ remmina/ui/remmina_survey.glade | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/remmina/src/remmina_survey.c b/remmina/src/remmina_survey.c index a1232b3846..8dae09a839 100644 --- a/remmina/src/remmina_survey.c +++ b/remmina/src/remmina_survey.c @@ -114,6 +114,9 @@ void remmina_survey_start(GtkWindow *parent) = GTK_DIALOG (gtk_builder_get_object(remmina_survey->builder, "dialog_remmina_survey")); remmina_survey->scrolledwindow = GTK_SCROLLED_WINDOW(GET_OBJECT("scrolledwindow")); + /* Connect signals */ + gtk_builder_connect_signals(remmina_survey->builder, NULL); + web_view = WEBKIT_WEB_VIEW(webkit_web_view_new()); if (parent) diff --git a/remmina/ui/remmina_survey.glade b/remmina/ui/remmina_survey.glade index c55f73019b..5888acdb9b 100644 --- a/remmina/ui/remmina_survey.glade +++ b/remmina/ui/remmina_survey.glade @@ -1,8 +1,8 @@ -"; + gchar *new; + + dirname = g_strdup_printf("%s", remmina_get_datadir()); + + output_file_path = g_strdup_printf("%s/%s", dirname, output_file_name); + + template = g_file_new_for_uri(templateuri); + output_file = g_file_new_for_path(output_file_path); + + g_file_load_contents(template, NULL, &tpl_content, NULL, NULL, &gerror); + g_object_unref(template); + if (gerror != NULL) + { + g_message ("Cannot open %s, because of: %s", templateuri, gerror->message); + g_error_free(gerror); + }else{ + /* We get the remmina data we need */ + new = remmina_survey_files_iter_setting(); + + /* We replace the placeholder in the template, with the remmina data */ + form = repl_str(tpl_content, old, new); + + g_file_replace_contents (output_file, form, strlen(form)+1, + NULL, + FALSE, + G_FILE_CREATE_REPLACE_DESTINATION, + NULL, NULL, &gerror); + g_object_unref(output_file); + if (gerror != NULL) + { + g_message ("Cannot open %s, because of: %s", output_file_path, gerror->message); + g_error_free(gerror); + } + } + g_free(tpl_content); + g_free(form); +} + void remmina_survey_dialog_on_close_clicked(GtkWidget *widget, RemminaSurveyDialog *dialog) { TRACE_CALL("remmina_survey_dialog_on_close_clicked"); @@ -72,9 +341,6 @@ static void remmina_survey_submit_form_callback(WebKitWebView *web_view, WebKitF name = g_hash_table_lookup (formsdata, "name"); mail = g_hash_table_lookup (formsdata, "email"); - /* CLEAN: just for test */ - printf ("name: %s\nmail: %s\n", name, mail); - /* Finally we submit the form */ webkit_form_submission_request_submit(request); @@ -124,8 +390,19 @@ void remmina_survey_on_startup(GtkWindow *parent) void remmina_survey_start(GtkWindow *parent) { TRACE_CALL("remmina_survey_start"); + + GDir *dir; + gchar *dirname; + gchar localurl[PATH_MAX]; + + dirname = g_strdup_printf("%s", remmina_get_datadir()); + dir = g_dir_open(dirname, 0, NULL); + remmina_survey = g_new0(RemminaSurveyDialog, 1); + /* setting up the form */ + remmina_survey_stats_create_html_form(); + remmina_survey->builder = remmina_public_gtk_builder_new_from_file("remmina_survey.glade"); remmina_survey->dialog = GTK_DIALOG (gtk_builder_get_object(remmina_survey->builder, "dialog_remmina_survey")); @@ -163,6 +440,7 @@ void remmina_survey_start(GtkWindow *parent) gtk_container_add(GTK_CONTAINER(remmina_survey->scrolledwindow), GTK_WIDGET(web_view)); gtk_widget_show(GTK_WIDGET(web_view)); - webkit_web_view_load_uri(web_view, survey_uri); + g_snprintf(localurl, PATH_MAX, "%s%s/%s", "file://", dirname, "local_remmina_form.html"); + webkit_web_view_load_uri(web_view, "file:///home/tmow/.remmina/local_remmina_form.html"); g_object_unref(G_OBJECT(remmina_survey->builder)); } From 826b571a2ef72737f7df0b5732d263e76dd8ebba Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Tue, 15 Dec 2015 02:06:28 +0100 Subject: [PATCH 17/51] Survey reminder popup if profiles > 5 --- remmina/src/remmina_main.c | 7 +++++++ remmina/src/remmina_survey.c | 3 +++ 2 files changed, 10 insertions(+) diff --git a/remmina/src/remmina_main.c b/remmina/src/remmina_main.c index 84462d265d..bc71fbd88d 100644 --- a/remmina/src/remmina_main.c +++ b/remmina/src/remmina_main.c @@ -440,6 +440,7 @@ static void remmina_main_load_files(gboolean refresh) gint items_count; gchar buf[200]; guint context_id; + static gboolean remmina_survey = TRUE; if (refresh) { @@ -496,6 +497,12 @@ static void remmina_main_load_files(gboolean refresh) context_id = gtk_statusbar_get_context_id(remminamain->statusbar_main, "status"); gtk_statusbar_pop(remminamain->statusbar_main, context_id); gtk_statusbar_push(remminamain->statusbar_main, context_id, buf); + /* Remmina survey reminder popup */ + if ( items_count > 5 && remmina_survey ) + { + remmina_survey_on_startup(remminamain->window); + remmina_survey = FALSE; + } } void remmina_main_on_action_connection_connect(GtkAction *action, gpointer user_data) diff --git a/remmina/src/remmina_survey.c b/remmina/src/remmina_survey.c index e01b38a05d..913d531f9e 100644 --- a/remmina/src/remmina_survey.c +++ b/remmina/src/remmina_survey.c @@ -384,6 +384,9 @@ void remmina_survey_on_startup(GtkWindow *parent) remmina_pref_save(); } + gtk_window_set_transient_for(GTK_WINDOW(dialog), parent); + gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE); + gtk_widget_destroy(dialog); } From 7f1f88b41030435fe13b4afd78ad75371415945e Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Tue, 15 Dec 2015 03:00:01 +0100 Subject: [PATCH 18/51] uneeded functions --- remmina/src/remmina_survey.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/remmina/src/remmina_survey.c b/remmina/src/remmina_survey.c index 913d531f9e..e01b38a05d 100644 --- a/remmina/src/remmina_survey.c +++ b/remmina/src/remmina_survey.c @@ -384,9 +384,6 @@ void remmina_survey_on_startup(GtkWindow *parent) remmina_pref_save(); } - gtk_window_set_transient_for(GTK_WINDOW(dialog), parent); - gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE); - gtk_widget_destroy(dialog); } From e0af46318bcaccab8689973e50d2cda30d011b25 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Thu, 17 Dec 2015 11:23:57 +0100 Subject: [PATCH 19/51] local url built from .remmina directory --- remmina/src/remmina_survey.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/remmina/src/remmina_survey.c b/remmina/src/remmina_survey.c index e01b38a05d..a6d58104d5 100644 --- a/remmina/src/remmina_survey.c +++ b/remmina/src/remmina_survey.c @@ -441,6 +441,6 @@ void remmina_survey_start(GtkWindow *parent) gtk_container_add(GTK_CONTAINER(remmina_survey->scrolledwindow), GTK_WIDGET(web_view)); gtk_widget_show(GTK_WIDGET(web_view)); g_snprintf(localurl, PATH_MAX, "%s%s/%s", "file://", dirname, "local_remmina_form.html"); - webkit_web_view_load_uri(web_view, "file:///home/tmow/.remmina/local_remmina_form.html"); + webkit_web_view_load_uri(web_view, localurl); g_object_unref(G_OBJECT(remmina_survey->builder)); } From 24c778fa83bce7ae11da0d785d4ec7de1fb1a5be Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Wed, 30 Dec 2015 14:28:09 +0100 Subject: [PATCH 20/51] fixed empty value --- remmina/src/remmina_survey.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/remmina/src/remmina_survey.c b/remmina/src/remmina_survey.c index a6d58104d5..1005ee1d7f 100644 --- a/remmina/src/remmina_survey.c +++ b/remmina/src/remmina_survey.c @@ -232,17 +232,21 @@ static gchar *remmina_survey_files_iter_setting() return FALSE; count_file++; for (i = 0; i < count_name; i++) { - name = g_key_file_get_string(gkeyfile, - "remmina", - g_strdup_printf("%s", setting_name[i]), - NULL); + if (setting_name[i]) + name = g_key_file_get_string(gkeyfile, + "remmina", + g_strdup_printf("%s\0", setting_name[i]), + NULL); /* Some settings exists only for certain plugin */ - if (!name) - continue; - remmina_survey_return_stat_from_setting(hash_table, - g_strdup_printf("%s_%s", - setting_name[i], - name)); + //g_print ("iter: %d - setting = %s and name = %s \n", i, setting_name[i], name); + if (name && !(*name == 0)){ + remmina_survey_return_stat_from_setting(hash_table, + g_strdup_printf("%s_%s", + setting_name[i], + name)); + //g_print ("iter: %d - hastable = %s_%s\n", i, setting_name[i], name); + g_free(name); + } } } ret = g_strjoin(NULL, @@ -259,7 +263,6 @@ static gchar *remmina_survey_files_iter_setting() //g_print("%s\n%s: %d\n", ret, (gchar *)key, GPOINTER_TO_INT(value)); } g_key_file_free(gkeyfile); - g_free(name); g_hash_table_destroy(hash_table); g_dir_close(dir); return ret; From da06806bf2904a56dc2d8079738e37a59657b797 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Wed, 30 Dec 2015 14:32:28 +0100 Subject: [PATCH 21/51] added tags to gitignore --- .gitignore | 56 ++++++++++++++++++++++++++---------------------------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/.gitignore b/.gitignore index e1bf7a96ec..e76c700b7e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,53 +1,51 @@ *.a -*.o -*.lo +*.glade# +*.gmo *.la -*.so +*.lo *.mo -*.gmo +*.o +*.pc +*.so *.swp *.tar.gz +*/po/Makefile.in.in +*/po/POTFILES +*/po/stamp-it *~ -*.pc -*.glade# +.cproject .deps +.intltool-merge-cache .libs -autom4te.cache +.project +.settings +CMakeFiles +CMakeCache.txt Makefile Makefile.in -aclocal.m4 _configs.sed +aclocal.m4 +autom4te.cache +cmake_install.cmake +cmake_uninstall.cmake +config.guess config.h config.log config.status -config.guess config.sub configure depcomp install-sh +install_manifest.txt libtool -.intltool-merge-cache +ltmain.sh missing +rfbint.h stamp-h1 -ltmain.sh -*/po/Makefile.in.in -*/po/POTFILES -*/po/stamp-it +tags -.project -.cproject -.settings - -CMakeFiles -CMakeCache.txt -cmake_install.cmake -install_manifest.txt -cmake_uninstall.cmake - -remmina/remmina - -rfbint.h -remmina/src/remmina -remmina/desktop/remmina.desktop remmina-plugins/libvncserver/rfb/rfbconfig.h remmina-plugins/telepathy/org.freedesktop.Telepathy.Client.Remmina.service +remmina/desktop/remmina.desktop +remmina/remmina +remmina/src/remmina From 7e8c6b4046cc320a21e20ba7926f855493c0de3b Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Thu, 31 Dec 2015 09:20:37 +0100 Subject: [PATCH 22/51] NUll character inside format --- remmina/src/remmina_survey.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/remmina/src/remmina_survey.c b/remmina/src/remmina_survey.c index 1005ee1d7f..7da5c91a53 100644 --- a/remmina/src/remmina_survey.c +++ b/remmina/src/remmina_survey.c @@ -216,6 +216,7 @@ static gchar *remmina_survey_files_iter_setting() return FALSE; gkeyfile = g_key_file_new(); hash_table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); + while ((dir_entry = g_dir_read_name(dir)) != NULL) { /* Olny *.remmina files */ if (!g_str_has_suffix(dir_entry, ".remmina\0")) @@ -235,7 +236,7 @@ static gchar *remmina_survey_files_iter_setting() if (setting_name[i]) name = g_key_file_get_string(gkeyfile, "remmina", - g_strdup_printf("%s\0", setting_name[i]), + g_strdup_printf("%s", setting_name[i]), NULL); /* Some settings exists only for certain plugin */ //g_print ("iter: %d - setting = %s and name = %s \n", i, setting_name[i], name); From 6a60bef1a9e0e8d1d024aeec407785bba817bbee Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Wed, 6 Jan 2016 02:00:40 +0100 Subject: [PATCH 23/51] Added UID, to identify uniquely a remmina installation --- remmina/src/remmina_pref.c | 50 +++++++++++++++++++++++++++++++++--- remmina/src/remmina_pref.h | 3 +++ remmina/src/remmina_survey.c | 14 +++++++++- 3 files changed, 63 insertions(+), 4 deletions(-) diff --git a/remmina/src/remmina_pref.c b/remmina/src/remmina_pref.c index ec299e716a..e02e685b2b 100644 --- a/remmina/src/remmina_pref.c +++ b/remmina/src/remmina_pref.c @@ -37,6 +37,7 @@ #include #include #include +#include #include "config.h" #include "remmina_public.h" #include "remmina_string_array.h" @@ -46,9 +47,6 @@ const gchar *default_resolutions = "640x480,800x600,1024x768,1152x864,1280x960,1400x1050"; const gchar *default_keystrokes = "Send hello world§hello world\\n"; -gchar *remmina_pref_file; -RemminaPref remmina_pref; - gchar *remmina_keymap_file; static GHashTable *remmina_keymap_table = NULL; @@ -90,6 +88,44 @@ static void remmina_pref_gen_secret(void) g_free(content); } +/* This function will generate a unique string to identify a remmina installation + * in a form like Linux+4.2.5-1-ARCH+x86_64+38637228 */ +static void remmina_pref_gen_uid(void) +{ + TRACE_CALL("remmina_pref_gen_uid"); + + GKeyFile *gkeyfile; + gchar uid[64]; + gchar *content; + gsize length; + + struct utsname name; + uname(&name); + + g_snprintf (uid, sizeof(uid), "%s+%s+%s+%x%x%x%x%x%x%x%x", + name.sysname, name.release, name.machine, + g_random_int_range(0,9), + g_random_int_range(0,9), + g_random_int_range(0,9), + g_random_int_range(0,9), + g_random_int_range(0,9), + g_random_int_range(0,9), + g_random_int_range(0,9), + g_random_int_range(0,9)); + + remmina_pref.uid = uid; + + gkeyfile = g_key_file_new(); + g_key_file_load_from_file(gkeyfile, remmina_pref_file, G_KEY_FILE_NONE, NULL); + g_key_file_set_string(gkeyfile, "remmina_pref", "uid", remmina_pref.uid); + content = g_key_file_to_data(gkeyfile, &length, NULL); + g_file_set_contents(remmina_pref_file, content, length, NULL); + + g_key_file_free(gkeyfile); + g_free(content); + +} + static guint remmina_pref_get_keyval_from_str(const gchar *str) { TRACE_CALL("remmina_pref_get_keyval_from_str"); @@ -455,6 +491,11 @@ void remmina_pref_init(void) else remmina_pref.secret = NULL; + if (g_key_file_has_key(gkeyfile, "remmina_pref", "uid", NULL)) + remmina_pref.uid = g_key_file_get_string(gkeyfile, "remmina_pref", "uid", NULL); + else + remmina_pref.uid = NULL; + if (g_key_file_has_key(gkeyfile, "remmina_pref", "vte_font", NULL)) remmina_pref.vte_font = g_key_file_get_string(gkeyfile, "remmina_pref", "vte_font", NULL); else @@ -503,6 +544,9 @@ void remmina_pref_init(void) if (remmina_pref.secret == NULL) remmina_pref_gen_secret(); + if (remmina_pref.uid == NULL) + remmina_pref_gen_uid(); + remmina_pref_init_keymap(); } diff --git a/remmina/src/remmina_pref.h b/remmina/src/remmina_pref.h index 1568c2000a..019b9c9790 100644 --- a/remmina/src/remmina_pref.h +++ b/remmina/src/remmina_pref.h @@ -154,6 +154,9 @@ typedef struct _RemminaPref /* Crypto */ gchar *secret; + + /* UID */ + gchar *uid; } RemminaPref; #define DEFAULT_SSH_PARSECONFIG TRUE diff --git a/remmina/src/remmina_survey.c b/remmina/src/remmina_survey.c index 7da5c91a53..5eac1ce488 100644 --- a/remmina/src/remmina_survey.c +++ b/remmina/src/remmina_survey.c @@ -45,9 +45,10 @@ #include #include #include "config.h" -#include "remmina_survey.h" +#include "remmina_file.h" #include "remmina_pref.h" #include "remmina_public.h" +#include "remmina_survey.h" #include "remmina/remmina_trace_calls.h" static gchar* templateuri = REMMINA_SURVEY_URI; @@ -56,6 +57,9 @@ static RemminaSurveyDialog *remmina_survey; static WebKitWebView* web_view; +gchar *remmina_pref_file; +RemminaPref remmina_pref; + #define GET_OBJECT(object_name) gtk_builder_get_object(remmina_survey->builder, object_name) /* Taken from http://creativeandcritical.net/str-replace-c */ @@ -250,6 +254,14 @@ static gchar *remmina_survey_files_iter_setting() } } } + + ret = g_strjoin(NULL, + g_strdup_printf("ID: %s\n", + //remmina_file_get_string(remmina_pref_file, + remmina_pref.uid), + ret, + NULL); + ret = g_strjoin(NULL, g_strdup_printf("Number of profiles: %d\n", count_file), ret, From 1c14046907adb0a39a163a4ba2ce0179da2b909a Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Wed, 6 Jan 2016 17:30:47 +0100 Subject: [PATCH 24/51] Survey popup reminder child of remminamain --- remmina/src/remmina_exec.c | 9 +++++++++ remmina/src/remmina_main.c | 6 ------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/remmina/src/remmina_exec.c b/remmina/src/remmina_exec.c index 1532a2760e..418cb17b5b 100644 --- a/remmina/src/remmina_exec.c +++ b/remmina/src/remmina_exec.c @@ -46,6 +46,7 @@ #include "remmina_about.h" #include "remmina_plugin_manager.h" #include "remmina_exec.h" +#include "remmina_survey.h" #include "remmina/remmina_trace_calls.h" void remmina_exec_command(RemminaCommandType command, const gchar* data) @@ -57,6 +58,7 @@ void remmina_exec_command(RemminaCommandType command, const gchar* data) GtkWindow* mainwindow; GtkDialog* prefdialog; RemminaEntryPlugin* plugin; + static gboolean remmina_survey = TRUE; switch (command) { @@ -71,6 +73,13 @@ void remmina_exec_command(RemminaCommandType command, const gchar* data) { widget = remmina_main_new(); gtk_widget_show(widget); + /* Remmina survey reminder popup */ + mainwindow = remmina_main_get_window(); + if ( remmina_survey ) + { + remmina_survey_on_startup(GTK_WINDOW(mainwindow)); + remmina_survey = FALSE; + } } break; diff --git a/remmina/src/remmina_main.c b/remmina/src/remmina_main.c index bc71fbd88d..e020e310cc 100644 --- a/remmina/src/remmina_main.c +++ b/remmina/src/remmina_main.c @@ -497,12 +497,6 @@ static void remmina_main_load_files(gboolean refresh) context_id = gtk_statusbar_get_context_id(remminamain->statusbar_main, "status"); gtk_statusbar_pop(remminamain->statusbar_main, context_id); gtk_statusbar_push(remminamain->statusbar_main, context_id, buf); - /* Remmina survey reminder popup */ - if ( items_count > 5 && remmina_survey ) - { - remmina_survey_on_startup(remminamain->window); - remmina_survey = FALSE; - } } void remmina_main_on_action_connection_connect(GtkAction *action, gpointer user_data) From 8c886f1d2cffdd10c4794a003500a7a2ce5f6f82 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Thu, 7 Jan 2016 00:02:54 +0100 Subject: [PATCH 25/51] unused variable --- remmina/src/remmina_main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/remmina/src/remmina_main.c b/remmina/src/remmina_main.c index e020e310cc..84462d265d 100644 --- a/remmina/src/remmina_main.c +++ b/remmina/src/remmina_main.c @@ -440,7 +440,6 @@ static void remmina_main_load_files(gboolean refresh) gint items_count; gchar buf[200]; guint context_id; - static gboolean remmina_survey = TRUE; if (refresh) { From 722906e5b63151cd95c8416d6c7b1c720a21e2d4 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Thu, 7 Jan 2016 00:54:33 +0100 Subject: [PATCH 26/51] fixed survey layout size --- remmina/ui/remmina_survey.glade | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/remmina/ui/remmina_survey.glade b/remmina/ui/remmina_survey.glade index 0b71ca0600..a9f1db50aa 100644 --- a/remmina/ui/remmina_survey.glade +++ b/remmina/ui/remmina_survey.glade @@ -39,7 +39,7 @@ Author: Antenore Gatta False Remmina User Survey 512 - 640 + 512 dialog @@ -102,8 +102,8 @@ Author: Antenore Gatta True True never - 640 - 480 + 512 + 512 From d6da74ddb40e5ae95fca280dad5364a61ed7c85f Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Thu, 7 Jan 2016 01:25:51 +0100 Subject: [PATCH 27/51] Code cleaning --- CMakeLists.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aba200e56b..c3f5eb6541 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,10 +121,8 @@ find_required_package(PTHREAD) find_suggested_package(GCRYPT) find_suggested_package(AVAHI) -IF (NOT DEFINED REMMINA_SURVEY_URI) - SET(REMMINA_SURVEY_URI "http://www.remmina.org/") -ENDIF() -ADD_DEFINITIONS(-DREMMINA_SURVEY_URI=${REMMINA_SURVEY_URI}) +# Survey URI +set(REMMINA_SURVEY_URI "http://www.remmina.org/survey/survey.tpl") if(WITH_TRACE_CALLS) message(STATUS "Enabling trace calls.") From 738fc638260f2b466dcffd782b693aec608925f3 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Mon, 11 Jan 2016 23:07:55 +0100 Subject: [PATCH 28/51] Wrong assignement to remmina_pref.uid and unused var --- remmina/src/remmina_pref.c | 6 +++--- remmina/src/remmina_survey.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/remmina/src/remmina_pref.c b/remmina/src/remmina_pref.c index e02e685b2b..0d78fd95c5 100644 --- a/remmina/src/remmina_pref.c +++ b/remmina/src/remmina_pref.c @@ -95,14 +95,14 @@ static void remmina_pref_gen_uid(void) TRACE_CALL("remmina_pref_gen_uid"); GKeyFile *gkeyfile; - gchar uid[64]; + gchar buf[64]; gchar *content; gsize length; struct utsname name; uname(&name); - g_snprintf (uid, sizeof(uid), "%s+%s+%s+%x%x%x%x%x%x%x%x", + g_snprintf (buf, sizeof(buf), "%s+%s+%s+%x%x%x%x%x%x%x%x", name.sysname, name.release, name.machine, g_random_int_range(0,9), g_random_int_range(0,9), @@ -113,7 +113,7 @@ static void remmina_pref_gen_uid(void) g_random_int_range(0,9), g_random_int_range(0,9)); - remmina_pref.uid = uid; + remmina_pref.uid = g_strdup(buf); gkeyfile = g_key_file_new(); g_key_file_load_from_file(gkeyfile, remmina_pref_file, G_KEY_FILE_NONE, NULL); diff --git a/remmina/src/remmina_survey.c b/remmina/src/remmina_survey.c index 5eac1ce488..703174587c 100644 --- a/remmina/src/remmina_survey.c +++ b/remmina/src/remmina_survey.c @@ -51,7 +51,7 @@ #include "remmina_survey.h" #include "remmina/remmina_trace_calls.h" -static gchar* templateuri = REMMINA_SURVEY_URI; +//static gchar* templateuri = REMMINA_SURVEY_URI; static RemminaSurveyDialog *remmina_survey; From 079e66a95962faa433d2deee13d390d564b5af6a Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Mon, 11 Jan 2016 23:58:12 +0100 Subject: [PATCH 29/51] code cleaning --- remmina/src/remmina_survey.c | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/remmina/src/remmina_survey.c b/remmina/src/remmina_survey.c index 703174587c..7924bd151f 100644 --- a/remmina/src/remmina_survey.c +++ b/remmina/src/remmina_survey.c @@ -51,8 +51,6 @@ #include "remmina_survey.h" #include "remmina/remmina_trace_calls.h" -//static gchar* templateuri = REMMINA_SURVEY_URI; - static RemminaSurveyDialog *remmina_survey; static WebKitWebView* web_view; @@ -163,9 +161,9 @@ static const gchar *remmina_get_datadir() } /* Insert setting name and its count in an hashtable */ -static void remmina_survey_return_stat_from_setting(GHashTable *hash_table, gchar *name) +static void remmina_survey_ret_stat_from_setting(GHashTable *hash_table, gchar *name) { - TRACE_CALL("remmina_survey_return_stat_from_setting"); + TRACE_CALL("remmina_survey_ret_stat_from_setting"); gint count_name; count_name = GPOINTER_TO_INT(g_hash_table_lookup(hash_table, name)); @@ -173,17 +171,14 @@ static void remmina_survey_return_stat_from_setting(GHashTable *hash_table, gcha if (count_name) { count_name++; - //g_print("name/count after lookup: %s/%d\n", name, count_name); g_hash_table_replace(hash_table, g_strdup(name), GINT_TO_POINTER(count_name)); - //g_print("name/count after replace: %s/%d\n", name, count_name); } else { count_name = 1; g_hash_table_replace(hash_table, g_strdup(name), GINT_TO_POINTER(count_name)); - //g_print("Found name: %s %d times\n", name, count_name); } } @@ -191,8 +186,6 @@ static gchar *remmina_survey_files_iter_setting() { TRACE_CALL("remmina_survey_files_iter_setting"); - //GError *gerror = NULL; - GDir *dir; gchar *dirname; gchar filename[PATH_MAX]; @@ -227,10 +220,7 @@ static gchar *remmina_survey_files_iter_setting() continue; g_snprintf(filename, PATH_MAX, "%s/%s", dirname, dir_entry); - if (!g_key_file_load_from_file(gkeyfile, - filename, - G_KEY_FILE_NONE, - NULL)) + if (!g_key_file_load_from_file(gkeyfile, filename, G_KEY_FILE_NONE, NULL)) g_key_file_free(gkeyfile); if (!g_key_file_has_key(gkeyfile, "remmina", "name", NULL)) @@ -243,13 +233,11 @@ static gchar *remmina_survey_files_iter_setting() g_strdup_printf("%s", setting_name[i]), NULL); /* Some settings exists only for certain plugin */ - //g_print ("iter: %d - setting = %s and name = %s \n", i, setting_name[i], name); if (name && !(*name == 0)){ - remmina_survey_return_stat_from_setting(hash_table, + remmina_survey_ret_stat_from_setting(hash_table, g_strdup_printf("%s_%s", - setting_name[i], - name)); - //g_print ("iter: %d - hastable = %s_%s\n", i, setting_name[i], name); + setting_name[i], + name)); g_free(name); } } @@ -257,7 +245,6 @@ static gchar *remmina_survey_files_iter_setting() ret = g_strjoin(NULL, g_strdup_printf("ID: %s\n", - //remmina_file_get_string(remmina_pref_file, remmina_pref.uid), ret, NULL); @@ -266,14 +253,12 @@ static gchar *remmina_survey_files_iter_setting() g_strdup_printf("Number of profiles: %d\n", count_file), ret, NULL); - //g_print ("Number of profiles: %d\n", count_file); g_hash_table_iter_init (&iter, hash_table); while (g_hash_table_iter_next (&iter, &key, &value)) { ret = g_strjoin(NULL, g_strdup_printf("%s: %d\n", (gchar *)key, GPOINTER_TO_INT(value)), ret, NULL); - //g_print("%s\n%s: %d\n", ret, (gchar *)key, GPOINTER_TO_INT(value)); } g_key_file_free(gkeyfile); g_hash_table_destroy(hash_table); @@ -286,7 +271,6 @@ static void remmina_survey_stats_create_html_form() { TRACE_CALL("remmina_survey_stats_create_html_form"); - //GDir *dir; gchar *dirname = NULL; const gchar *templateuri = REMMINA_SURVEY_URI; const gchar *output_file_name = "local_remmina_form.html"; From a6a2a94c171a7c4630819cc99b575c2de259267d Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Thu, 14 Jan 2016 15:48:15 +0100 Subject: [PATCH 30/51] Changed old links --- remmina/src/remmina_main.c | 10 ++++++++-- remmina/ui/remmina_main.glade | 16 ++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/remmina/src/remmina_main.c b/remmina/src/remmina_main.c index b2042e6ff6..33d947e77d 100644 --- a/remmina/src/remmina_main.c +++ b/remmina/src/remmina_main.c @@ -881,13 +881,19 @@ void remmina_main_on_action_application_plugins(GtkAction *action, gpointer user void remmina_main_on_action_help_homepage(GtkAction *action, gpointer user_data) { TRACE_CALL("remmina_main_on_action_help_homepage"); - g_app_info_launch_default_for_uri("http://remmina.sourceforge.net", NULL, NULL); + g_app_info_launch_default_for_uri("http://www.remmina.org", NULL, NULL); } void remmina_main_on_action_help_wiki(GtkAction *action, gpointer user_data) { TRACE_CALL("remmina_main_on_action_help_wiki"); - g_app_info_launch_default_for_uri("http://sourceforge.net/apps/mediawiki/remmina/", NULL, NULL); + g_app_info_launch_default_for_uri("https://github.com/FreeRDP/Remmina/wiki", NULL, NULL); +} + +void remmina_main_on_action_help_donations(GtkAction *action, gpointer user_data) +{ + TRACE_CALL("remmina_main_on_action_help_donations"); + g_app_info_launch_default_for_uri("http://www.remmina.org/wp/donations", NULL, NULL); } void remmina_main_on_action_help_debug(GtkAction *action, gpointer user_data) diff --git a/remmina/ui/remmina_main.glade b/remmina/ui/remmina_main.glade index 780191e0b6..ee9056780d 100644 --- a/remmina/ui/remmina_main.glade +++ b/remmina/ui/remmina_main.glade @@ -123,6 +123,13 @@ + + + Donations + Donations + + + Debug Window @@ -535,6 +542,15 @@ True + + + action_help_donations + True + False + Donations + True + + action_help_debug From a9ca1d353f079d8e500f40d853bc70185552872b Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Thu, 14 Jan 2016 18:01:13 +0100 Subject: [PATCH 31/51] freerdp library renamed to freerdp2 --- cmake/FindFREERDP.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake/FindFREERDP.cmake b/cmake/FindFREERDP.cmake index a32d3b1f76..c98510d449 100644 --- a/cmake/FindFREERDP.cmake +++ b/cmake/FindFREERDP.cmake @@ -19,7 +19,7 @@ find_package(PkgConfig) if(PKG_CONFIG_FOUND) - pkg_check_modules(PC_FREERDP freerdp>=${FREERDP_REQUIRED_VERSIONSTRING}) + pkg_check_modules(PC_FREERDP freerdp2>=${FREERDP_REQUIRED_VERSIONSTRING}) endif() set(FREERDP_DEFINITIONS ${PC_FREERDP_CFLAGS_OTHER}) @@ -27,13 +27,13 @@ set(FREERDP_DEFINITIONS ${PC_FREERDP_CFLAGS_OTHER}) find_path(FREERDP_INCLUDE_DIR NAMES freerdp/freerdp.h HINTS ${PC_FREERDP_INCLUDEDIR} ${PC_FREERDP_INCLUDE_DIRS}) -find_library(FREERDP_LIBRARY NAMES freerdp +find_library(FREERDP_LIBRARY NAMES freerdp2 HINTS ${PC_FREERDP_LIBDIR} ${PC_FREERDP_LIBRARY_DIRS}) -find_library(FREERDP_CLIENT_LIBRARY NAMES freerdp-client +find_library(FREERDP_CLIENT_LIBRARY NAMES freerdp-client2 HINTS ${PC_FREERDP_LIBDIR} ${PC_FREERDP_LIBRARY_DIRS}) -find_library(FREERDP_WINPR_LIBRARY NAMES winpr +find_library(FREERDP_WINPR_LIBRARY NAMES winpr1 HINTS ${PC_FREERDP_LIBDIR} ${PC_FREERDP_LIBRARY_DIRS}) include(FindPackageHandleStandardArgs) From 1618265aaccd40a60d530397ee6174239ec27871 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Sun, 17 Jan 2016 14:51:35 +0100 Subject: [PATCH 32/51] Manually merged cmake delta for freerdp2 --- cmake/FindFREERDP.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake/FindFREERDP.cmake b/cmake/FindFREERDP.cmake index 986703b4a2..3a3463a073 100644 --- a/cmake/FindFREERDP.cmake +++ b/cmake/FindFREERDP.cmake @@ -19,7 +19,7 @@ find_package(PkgConfig) if(PKG_CONFIG_FOUND) - pkg_check_modules(PC_FREERDP freerdp2>=${FREERDP_REQUIRED_VERSIONSTRING}) + pkg_check_modules(PC_FREERDP freerdp>=${FREERDP_REQUIRED_VERSIONSTRING}) endif() set(FREERDP_DEFINITIONS ${PC_FREERDP_CFLAGS_OTHER}) @@ -30,13 +30,13 @@ find_path(FREERDP_INCLUDE_DIR NAMES freerdp/freerdp.h find_path(WINPR_INCLUDE_DIR NAMES winpr/winpr.h HINTS ${PC_FREERDP_INCLUDEDIR} ${PC_FREERDP_INCLUDE_DIRS} ${CMAKE_PREFIX_PATH}/include/winpr1/) -find_library(FREERDP_LIBRARY NAMES freerdp2 +find_library(FREERDP_LIBRARY NAMES freerdp HINTS ${PC_FREERDP_LIBDIR} ${PC_FREERDP_LIBRARY_DIRS}) -find_library(FREERDP_CLIENT_LIBRARY NAMES freerdp-client2 +find_library(FREERDP_CLIENT_LIBRARY NAMES freerdp-client HINTS ${PC_FREERDP_LIBDIR} ${PC_FREERDP_LIBRARY_DIRS}) -find_library(FREERDP_WINPR_LIBRARY NAMES winpr1 +find_library(FREERDP_WINPR_LIBRARY NAMES winpr HINTS ${PC_FREERDP_LIBDIR} ${PC_FREERDP_LIBRARY_DIRS}) include(FindPackageHandleStandardArgs) From c0de5d7c7256338f704b5910fefd4990afa7f476 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Sun, 17 Jan 2016 14:51:59 +0100 Subject: [PATCH 33/51] Added LANG to user profile uid --- remmina/src/remmina_pref.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/remmina/src/remmina_pref.c b/remmina/src/remmina_pref.c index 0d78fd95c5..0b4b38437c 100644 --- a/remmina/src/remmina_pref.c +++ b/remmina/src/remmina_pref.c @@ -98,12 +98,18 @@ static void remmina_pref_gen_uid(void) gchar buf[64]; gchar *content; gsize length; + const char *env_lang; + + env_lang = g_getenv ("LANG"); + if (env_lang == NULL) + env_lang = "NA"; struct utsname name; uname(&name); - g_snprintf (buf, sizeof(buf), "%s+%s+%s+%x%x%x%x%x%x%x%x", + g_snprintf (buf, sizeof(buf), "%s+%s+%s+%s+%x%x%x%x%x%x%x%x", name.sysname, name.release, name.machine, + env_lang, g_random_int_range(0,9), g_random_int_range(0,9), g_random_int_range(0,9), From 4f56277f1cebc57d74bdc353cbfca06025215ff4 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Mon, 18 Jan 2016 21:29:00 +0100 Subject: [PATCH 34/51] Add G+ community link --- remmina/src/remmina_main.c | 6 ++++++ remmina/ui/remmina_main.glade | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/remmina/src/remmina_main.c b/remmina/src/remmina_main.c index 33d947e77d..1aff91d933 100644 --- a/remmina/src/remmina_main.c +++ b/remmina/src/remmina_main.c @@ -890,6 +890,12 @@ void remmina_main_on_action_help_wiki(GtkAction *action, gpointer user_data) g_app_info_launch_default_for_uri("https://github.com/FreeRDP/Remmina/wiki", NULL, NULL); } +void remmina_main_on_action_help_gplus(GtkAction *action, gpointer user_data) +{ + TRACE_CALL("remmina_main_on_action_help_gplus"); + g_app_info_launch_default_for_uri("https://plus.google.com/communities/106276095923371962010", NULL, NULL); +} + void remmina_main_on_action_help_donations(GtkAction *action, gpointer user_data) { TRACE_CALL("remmina_main_on_action_help_donations"); diff --git a/remmina/ui/remmina_main.glade b/remmina/ui/remmina_main.glade index ee9056780d..df0b35f891 100644 --- a/remmina/ui/remmina_main.glade +++ b/remmina/ui/remmina_main.glade @@ -123,6 +123,13 @@ + + + G+ Remmina Community + G+ Remmina Community + + + Donations From 7121f24b368ae5a264a2d3423e4667866962822a Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Mon, 18 Jan 2016 21:47:43 +0100 Subject: [PATCH 35/51] Added G+ help menu item --- remmina/ui/remmina_main.glade | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/remmina/ui/remmina_main.glade b/remmina/ui/remmina_main.glade index df0b35f891..34f14484ab 100644 --- a/remmina/ui/remmina_main.glade +++ b/remmina/ui/remmina_main.glade @@ -549,6 +549,15 @@ True + + + action_help_gplus + True + False + G+ Remmina Community + True + + action_help_donations From 32ddd881477b5492178424b775c1d6be2d5e959c Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Mon, 18 Jan 2016 23:02:52 +0100 Subject: [PATCH 36/51] Start survey only if network is up --- remmina/src/remmina_exec.c | 3 ++- remmina/src/remmina_survey.c | 34 ++++++++++++++++++++++++++++++++++ remmina/src/remmina_survey.h | 1 + 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/remmina/src/remmina_exec.c b/remmina/src/remmina_exec.c index ee8eb68013..188d44e38b 100644 --- a/remmina/src/remmina_exec.c +++ b/remmina/src/remmina_exec.c @@ -101,7 +101,8 @@ void remmina_exec_command(RemminaCommandType command, const gchar* data) mainwindow = remmina_main_get_window(); if ( remmina_survey ) { - remmina_survey_on_startup(GTK_WINDOW(mainwindow)); + /* test if network is up and start survey */ + remmina_survey_cb(GTK_WINDOW(mainwindow)); remmina_survey = FALSE; } } diff --git a/remmina/src/remmina_survey.c b/remmina/src/remmina_survey.c index 7924bd151f..4f9e1c64e9 100644 --- a/remmina/src/remmina_survey.c +++ b/remmina/src/remmina_survey.c @@ -138,6 +138,40 @@ static char *repl_str(const char *str, const char *old, const char *new) return ret; } +static void remmina_survey_connect_done_cb(GObject *source_object, GAsyncResult *result, gpointer user_data) +{ + TRACE_CALL("remmina_survey_connect_done_cb"); + GError * error = NULL; + GSocketConnection * connection = NULL; + GSocketClient *client = G_SOCKET_CLIENT (source_object); + + connection = g_socket_client_connect_to_host_finish (client, result, &error); + + if (connection == NULL) { + //g_print ("\nConnection NOT successful!\n"); + return; + } + else { + //g_print ("\nConnection successful!\n"); + remmina_survey_on_startup(user_data); + } +} + +gboolean remmina_survey_cb(gpointer data) +{ + TRACE_CALL("remmina_survey_cb"); + /* create a new connection */ + GSocketClient * client = g_socket_client_new(); + + /* connect to the host */ + g_socket_client_connect_to_host_async (client, + (gchar*)"www.remmina.org", + 80, /* your port goes here */ + NULL, + remmina_survey_connect_done_cb, data); + return TRUE; +} + /* Get the dirname where remmina files are stored TODO: fix xdg in all files */ static const gchar *remmina_get_datadir() { diff --git a/remmina/src/remmina_survey.h b/remmina/src/remmina_survey.h index 1bfd2c2c6f..da21602e9e 100644 --- a/remmina/src/remmina_survey.h +++ b/remmina/src/remmina_survey.h @@ -46,6 +46,7 @@ typedef struct _RemminaSurveyDialog G_BEGIN_DECLS void remmina_survey_on_startup(GtkWindow *parent); +gboolean remmina_survey_cb(gpointer data); void remmina_survey_start(); G_END_DECLS From ca7a3675e31c0d03d07856c36845032020a3c9fd Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Mon, 18 Jan 2016 23:27:37 +0100 Subject: [PATCH 37/51] Code cleaning and rewording --- remmina/src/remmina_survey.c | 151 ++++++++++++++++++----------------- 1 file changed, 76 insertions(+), 75 deletions(-) diff --git a/remmina/src/remmina_survey.c b/remmina/src/remmina_survey.c index 4f9e1c64e9..dcae85e69d 100644 --- a/remmina/src/remmina_survey.c +++ b/remmina/src/remmina_survey.c @@ -138,40 +138,6 @@ static char *repl_str(const char *str, const char *old, const char *new) return ret; } -static void remmina_survey_connect_done_cb(GObject *source_object, GAsyncResult *result, gpointer user_data) -{ - TRACE_CALL("remmina_survey_connect_done_cb"); - GError * error = NULL; - GSocketConnection * connection = NULL; - GSocketClient *client = G_SOCKET_CLIENT (source_object); - - connection = g_socket_client_connect_to_host_finish (client, result, &error); - - if (connection == NULL) { - //g_print ("\nConnection NOT successful!\n"); - return; - } - else { - //g_print ("\nConnection successful!\n"); - remmina_survey_on_startup(user_data); - } -} - -gboolean remmina_survey_cb(gpointer data) -{ - TRACE_CALL("remmina_survey_cb"); - /* create a new connection */ - GSocketClient * client = g_socket_client_new(); - - /* connect to the host */ - g_socket_client_connect_to_host_async (client, - (gchar*)"www.remmina.org", - 80, /* your port goes here */ - NULL, - remmina_survey_connect_done_cb, data); - return TRUE; -} - /* Get the dirname where remmina files are stored TODO: fix xdg in all files */ static const gchar *remmina_get_datadir() { @@ -380,47 +346,6 @@ static void remmina_survey_submit_form_callback(WebKitWebView *web_view, WebKitF } -/* Show the preliminary survey dialog when remmina start */ -void remmina_survey_on_startup(GtkWindow *parent) -{ - TRACE_CALL("remmina_survey"); - - GtkWidget *dialog, *check; - - dialog = gtk_message_dialog_new(GTK_WINDOW (parent), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_QUESTION, - GTK_BUTTONS_YES_NO, - "%s", - /* translators: Primary message of a dialog used to notify the user about the survey */ - _("We are conducting a user survey\n would you like to take it now?")); - - gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", - /* translators: Secondary text of a dialog used to notify the user about the survey */ - _("If not, you can always find it in the Help menu.")); - - check = gtk_check_button_new_with_mnemonic (_("_Do not show this dialog again")); - gtk_box_pack_end (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), - check, FALSE, FALSE, 0); - gtk_widget_set_halign (check, GTK_ALIGN_START); - gtk_widget_set_margin_start (check, 6); - gtk_widget_show (check); - - if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES) - { - remmina_survey_start(parent); - } - - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check))) - { - /* Save survey option */ - remmina_pref.survey = FALSE; - remmina_pref_save(); - } - - gtk_widget_destroy(dialog); -} - void remmina_survey_start(GtkWindow *parent) { TRACE_CALL("remmina_survey_start"); @@ -478,3 +403,79 @@ void remmina_survey_start(GtkWindow *parent) webkit_web_view_load_uri(web_view, localurl); g_object_unref(G_OBJECT(remmina_survey->builder)); } + +/* Show the preliminary survey dialog when remmina start */ +void remmina_survey_on_startup(GtkWindow *parent) +{ + TRACE_CALL("remmina_survey"); + + GtkWidget *dialog, *check; + + dialog = gtk_message_dialog_new(GTK_WINDOW (parent), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_YES_NO, + "%s", + /* translators: Primary message of a dialog used to notify the user about the survey */ + _("Do you agree to share some usage statistics with us?")); + + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", + /* translators: Secondary text of a dialog used to notify the user about the survey */ + _("By pressing the yes button, you're not yet sending any data.")); + + check = gtk_check_button_new_with_mnemonic (_("_Do not show this dialog again")); + gtk_box_pack_end (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), + check, FALSE, FALSE, 0); + gtk_widget_set_halign (check, GTK_ALIGN_START); + gtk_widget_set_margin_start (check, 6); + gtk_widget_show (check); + + if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES) + { + remmina_survey_start(parent); + } + + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check))) + { + /* Save survey option */ + remmina_pref.survey = FALSE; + remmina_pref_save(); + } + + gtk_widget_destroy(dialog); +} + +static void remmina_survey_connect_done_cb(GObject *source_object, GAsyncResult *result, gpointer user_data) +{ + TRACE_CALL("remmina_survey_connect_done_cb"); + GError * error = NULL; + GSocketConnection * connection = NULL; + GSocketClient *client = G_SOCKET_CLIENT (source_object); + + connection = g_socket_client_connect_to_host_finish (client, result, &error); + + if (connection == NULL) { + //g_print ("\nConnection NOT successful!\n"); + return; + } + else { + //g_print ("\nConnection successful!\n"); + remmina_survey_on_startup(user_data); + } +} + +gboolean remmina_survey_cb(gpointer data) +{ + TRACE_CALL("remmina_survey_cb"); + /* create a new connection */ + GSocketClient * client = g_socket_client_new(); + + /* connect to the host */ + g_socket_client_connect_to_host_async (client, + (gchar*)"www.remmina.org", + 80, /* your port goes here */ + NULL, + remmina_survey_connect_done_cb, data); + return TRUE; +} + From 0b33c5f31c2044815fce8578c70797f6b25f0b19 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Wed, 20 Jan 2016 00:16:53 +0100 Subject: [PATCH 38/51] rollback b83e583 as by Gio request --- remmina-plugins/rdp/rdp_plugin.c | 85 ++------------------------------ remmina-plugins/rdp/rdp_plugin.h | 2 - remmina/po/it.po | 3 -- 3 files changed, 3 insertions(+), 87 deletions(-) diff --git a/remmina-plugins/rdp/rdp_plugin.c b/remmina-plugins/rdp/rdp_plugin.c index 4815e9dcba..8352414bbc 100644 --- a/remmina-plugins/rdp/rdp_plugin.c +++ b/remmina-plugins/rdp/rdp_plugin.c @@ -52,9 +52,6 @@ #include #include #include -#include -#include -#include #define REMMINA_RDP_FEATURE_TOOL_REFRESH 1 #define REMMINA_RDP_FEATURE_SCALE 2 @@ -67,8 +64,6 @@ RemminaPluginService* remmina_plugin_service = NULL; static char remmina_rdp_plugin_default_drive_name[]="RemminaDisk"; -static gboolean use_remmina_socket; - static BOOL rf_process_event_queue(RemminaProtocolWidget* gp) { TRACE_CALL("rf_process_event_queue"); @@ -917,97 +912,30 @@ static gboolean remmina_rdp_main(RemminaProtocolWidget* gp) freerdp_device_collection_add(rfi->settings, (RDPDR_DEVICE*) smartcard); } - /* Connect to the remote server */ - if (use_remmina_socket) { - - struct addrinfo hints; - struct addrinfo* result = NULL, *rp; - char *newServerHostname; - int status; - int sfd; - socklen_t optlen; - UINT32 optval; - char service[16]; - - memset(&hints, 0, sizeof(struct addrinfo)); - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - hints.ai_flags = 0; - hints.ai_protocol = 0; - - sprintf(service, "%d", rfi->settings->ServerPort); - status = getaddrinfo(rfi->settings->ServerHostname, service, &hints, &result); - - if (status != 0) { - remmina_plugin_service->protocol_plugin_set_error(gp, _("Unable to find the address of RDP server %s."), - rfi->settings->ServerHostname); - return FALSE; - } - - for (rp = result; rp != NULL; rp = rp->ai_next) { - sfd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol); - if (sfd == -1) - continue; - if (connect(sfd, rp->ai_addr, rp->ai_addrlen) != -1) - break; - close(sfd); - } - - if (rp == NULL) { - /* connect error */ - gchar *msg = g_strdup_printf("%s. %s", _("Unable to connect to RDP server %s"), strerror(errno)); - remmina_plugin_service->protocol_plugin_set_error(gp, msg, rfi->settings->ServerHostname ); - g_free(msg); - freeaddrinfo(result); - return FALSE; - } - freeaddrinfo(result); - - optval = 1; - optlen = sizeof(optval); - if (setsockopt(sfd, IPPROTO_TCP, TCP_NODELAY, (void*) &optval, optlen) < 0) - g_printf("WARNING: unable to set TCP_NODELAY\n"); - - rfi->sockfd = sfd; - - newServerHostname = strdup("|"); - free(rfi->settings->ServerHostname); - rfi->settings->ServerHostname = newServerHostname; - - rfi->settings->ServerPort = sfd; - - } - - if (!freerdp_connect(rfi->instance)) { if (!rfi->user_cancelled) { UINT32 e; - const char *server; e = freerdp_get_last_error(rfi->instance->context); - server = remmina_plugin_service->file_get_string(remminafile, "server"); switch(e) { case FREERDP_ERROR_AUTHENTICATION_FAILED: remmina_plugin_service->protocol_plugin_set_error(gp, _("Authentication to RDP server %s failed.\nCheck username, password and domain."), - server ); + rfi->settings->ServerHostname ); // Invalidate the saved password, so the user will be re-asked at next logon remmina_plugin_service->file_unsave_password(remminafile); break; case FREERDP_ERROR_CONNECT_FAILED: - remmina_plugin_service->protocol_plugin_set_error(gp, _("Connection to RDP server %s failed."), server); + remmina_plugin_service->protocol_plugin_set_error(gp, _("Connection to RDP server %s failed."), rfi->settings->ServerHostname ); break; default: - remmina_plugin_service->protocol_plugin_set_error(gp, _("Unable to connect to RDP server %s"), server); + remmina_plugin_service->protocol_plugin_set_error(gp, _("Unable to connect to RDP server %s"), rfi->settings->ServerHostname); break; } } - if (use_remmina_socket) - close(rfi->sockfd); - return FALSE; } @@ -1015,9 +943,6 @@ static gboolean remmina_rdp_main(RemminaProtocolWidget* gp) remmina_rdp_main_loop(gp); - if (use_remmina_socket) - close(rfi->sockfd); - return TRUE; } @@ -1392,10 +1317,6 @@ G_MODULE_EXPORT gboolean remmina_plugin_entry(RemminaPluginService* service) return FALSE; } - /* Very inaccurate way to determine whether to use our socket or libfreerdp socket */ - if (vermaj >= 2) - use_remmina_socket = TRUE; - bindtextdomain(GETTEXT_PACKAGE, REMMINA_LOCALEDIR); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); diff --git a/remmina-plugins/rdp/rdp_plugin.h b/remmina-plugins/rdp/rdp_plugin.h index 03286e860a..8084875940 100644 --- a/remmina-plugins/rdp/rdp_plugin.h +++ b/remmina-plugins/rdp/rdp_plugin.h @@ -164,8 +164,6 @@ struct rf_context GAsyncQueue* ui_queue; guint ui_handler; - int sockfd; - GArray* pressed_keys; GAsyncQueue* event_queue; gint event_pipe[2]; diff --git a/remmina/po/it.po b/remmina/po/it.po index 66e0ebe539..33a48d133f 100644 --- a/remmina/po/it.po +++ b/remmina/po/it.po @@ -1606,6 +1606,3 @@ msgstr "Configura le battute" msgid "Listening connection on protocol TCP" msgstr "Connessione in ascolto su protocollo TCP" - -msgid "Unable to find the address of RDP server %s." -msgstr "Impossibile trovare l'indirizzo IP del server RDP %s." From 925d0f909bdf123a5f2cbba4830c298abb773f4e Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Wed, 20 Jan 2016 01:08:01 +0100 Subject: [PATCH 39/51] Propose the survey only if the user have at least 1 profile --- remmina/src/remmina_exec.c | 3 ++- remmina/src/remmina_public.c | 36 ++++++++++++++++++++++++++++++++++++ remmina/src/remmina_public.h | 1 + remmina/src/remmina_survey.c | 1 + 4 files changed, 40 insertions(+), 1 deletion(-) diff --git a/remmina/src/remmina_exec.c b/remmina/src/remmina_exec.c index 188d44e38b..9eae3ea5ad 100644 --- a/remmina/src/remmina_exec.c +++ b/remmina/src/remmina_exec.c @@ -45,6 +45,7 @@ #include "remmina_connection_window.h" #include "remmina_about.h" #include "remmina_plugin_manager.h" +#include "remmina_public.h" #include "remmina_exec.h" #include "remmina_survey.h" #include "remmina_icon.h" @@ -99,7 +100,7 @@ void remmina_exec_command(RemminaCommandType command, const gchar* data) gtk_widget_show(widget); /* Remmina survey reminder popup */ mainwindow = remmina_main_get_window(); - if ( remmina_survey ) + if ( remmina_survey && remmina_public_count_profile() >= 1) { /* test if network is up and start survey */ remmina_survey_cb(GTK_WINDOW(mainwindow)); diff --git a/remmina/src/remmina_public.c b/remmina/src/remmina_public.c index 4b97fa392d..8b830b5f3b 100644 --- a/remmina/src/remmina_public.c +++ b/remmina/src/remmina_public.c @@ -701,3 +701,39 @@ void remmina_public_str_replace_in_place(gchar *string, const gchar *search, con string = g_strdup(new_string); return; } +/* Get the number of remmina profiles counting how many .remmina file we have */ +gint +remmina_public_count_profile() +{ + TRACE_CALL("remmina_public_count_profile"); + + GDir *dir; + static gchar remdir[PATH_MAX]; + GError *gerror = NULL; + gchar filename[PATH_MAX]; + const gchar *dir_entry; + gint count_profile=0; + + g_snprintf(remdir, sizeof(remdir), "%s/.%s", g_get_home_dir(), "remmina"); + dir = g_dir_open(remdir, 0, &gerror); + if (gerror != NULL) + { + g_message("Cannot open %s, with error: %s", remdir, gerror->message); + g_error_free(gerror); + g_snprintf(remdir, sizeof(remdir), + "%s/%s", g_get_user_data_dir(), "remmina"); + }else{ + + while ((dir_entry = g_dir_read_name(dir)) != NULL) { + /* Olny *.remmina files */ + if (!g_str_has_suffix(dir_entry, ".remmina\0")) + continue; + g_snprintf(filename, PATH_MAX, "%s/%s", remdir, dir_entry); + + if (filename != NULL) + count_profile++; + } + g_dir_close(dir); + } + return count_profile; +} diff --git a/remmina/src/remmina_public.h b/remmina/src/remmina_public.h index 9dc015a12b..31cd295636 100644 --- a/remmina/src/remmina_public.h +++ b/remmina/src/remmina_public.h @@ -110,4 +110,5 @@ gboolean remmina_public_resolution_validation_func(const gchar *new_str, gchar * /* 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); +gint remmina_public_count_profile(); #endif /* __REMMINAPUBLIC_H__ */ diff --git a/remmina/src/remmina_survey.c b/remmina/src/remmina_survey.c index dcae85e69d..931f39183b 100644 --- a/remmina/src/remmina_survey.c +++ b/remmina/src/remmina_survey.c @@ -191,6 +191,7 @@ static gchar *remmina_survey_files_iter_setting() gchar filename[PATH_MAX]; const gchar *dir_entry; + /* TODO: Substitute with remmina_public_count_profile() */ gint count_file=0; gchar *name; From 7ee7da6f9275679a173478fca0ede60d13fb6836 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Wed, 20 Jan 2016 17:51:06 +0100 Subject: [PATCH 40/51] profile validation and code cleaning --- remmina/src/remmina_exec.c | 3 +-- remmina/src/remmina_public.c | 36 ----------------------------------- remmina/src/remmina_public.h | 1 - remmina/src/remmina_survey.c | 37 ++++++++++++++++++++++++++++++++++++ remmina/src/remmina_survey.h | 1 + 5 files changed, 39 insertions(+), 39 deletions(-) diff --git a/remmina/src/remmina_exec.c b/remmina/src/remmina_exec.c index 9eae3ea5ad..1514534b8a 100644 --- a/remmina/src/remmina_exec.c +++ b/remmina/src/remmina_exec.c @@ -45,7 +45,6 @@ #include "remmina_connection_window.h" #include "remmina_about.h" #include "remmina_plugin_manager.h" -#include "remmina_public.h" #include "remmina_exec.h" #include "remmina_survey.h" #include "remmina_icon.h" @@ -100,7 +99,7 @@ void remmina_exec_command(RemminaCommandType command, const gchar* data) gtk_widget_show(widget); /* Remmina survey reminder popup */ mainwindow = remmina_main_get_window(); - if ( remmina_survey && remmina_public_count_profile() >= 1) + if ( remmina_survey && remmina_survey_valid_profile()) { /* test if network is up and start survey */ remmina_survey_cb(GTK_WINDOW(mainwindow)); diff --git a/remmina/src/remmina_public.c b/remmina/src/remmina_public.c index 8b830b5f3b..4b97fa392d 100644 --- a/remmina/src/remmina_public.c +++ b/remmina/src/remmina_public.c @@ -701,39 +701,3 @@ void remmina_public_str_replace_in_place(gchar *string, const gchar *search, con string = g_strdup(new_string); return; } -/* Get the number of remmina profiles counting how many .remmina file we have */ -gint -remmina_public_count_profile() -{ - TRACE_CALL("remmina_public_count_profile"); - - GDir *dir; - static gchar remdir[PATH_MAX]; - GError *gerror = NULL; - gchar filename[PATH_MAX]; - const gchar *dir_entry; - gint count_profile=0; - - g_snprintf(remdir, sizeof(remdir), "%s/.%s", g_get_home_dir(), "remmina"); - dir = g_dir_open(remdir, 0, &gerror); - if (gerror != NULL) - { - g_message("Cannot open %s, with error: %s", remdir, gerror->message); - g_error_free(gerror); - g_snprintf(remdir, sizeof(remdir), - "%s/%s", g_get_user_data_dir(), "remmina"); - }else{ - - while ((dir_entry = g_dir_read_name(dir)) != NULL) { - /* Olny *.remmina files */ - if (!g_str_has_suffix(dir_entry, ".remmina\0")) - continue; - g_snprintf(filename, PATH_MAX, "%s/%s", remdir, dir_entry); - - if (filename != NULL) - count_profile++; - } - g_dir_close(dir); - } - return count_profile; -} diff --git a/remmina/src/remmina_public.h b/remmina/src/remmina_public.h index 31cd295636..9dc015a12b 100644 --- a/remmina/src/remmina_public.h +++ b/remmina/src/remmina_public.h @@ -110,5 +110,4 @@ gboolean remmina_public_resolution_validation_func(const gchar *new_str, gchar * /* 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); -gint remmina_public_count_profile(); #endif /* __REMMINAPUBLIC_H__ */ diff --git a/remmina/src/remmina_survey.c b/remmina/src/remmina_survey.c index 931f39183b..b51984ce68 100644 --- a/remmina/src/remmina_survey.c +++ b/remmina/src/remmina_survey.c @@ -160,6 +160,43 @@ static const gchar *remmina_get_datadir() return remdir; } +/* At least one .remmina file */ +gboolean remmina_survey_valid_profile() +{ + TRACE_CALL("remmina_public_count_profile"); + + GDir *dir; + static gchar remdir[PATH_MAX]; + GError *gerror = NULL; + gchar filename[PATH_MAX]; + const gchar *dir_entry; + gint count_profile=0; + gint min_profiles=1; /* Use a constant */ + + g_snprintf(remdir, sizeof(remdir), "%s/.%s", g_get_home_dir(), "remmina"); + dir = g_dir_open(remdir, 0, &gerror); + if (gerror != NULL) + { + g_message("Cannot open %s, with error: %s", remdir, gerror->message); + g_error_free(gerror); + g_snprintf(remdir, sizeof(remdir), + "%s/%s", g_get_user_data_dir(), "remmina"); + }else{ + + while ((dir_entry = g_dir_read_name(dir)) != NULL) { + /* Olny *.remmina files */ + if (!g_str_has_suffix(dir_entry, ".remmina\0")) + continue; + g_snprintf(filename, PATH_MAX, "%s/%s", remdir, dir_entry); + + if (filename != NULL) + count_profile++; + } + g_dir_close(dir); + } + return (count_profile >= min_profiles); +} + /* Insert setting name and its count in an hashtable */ static void remmina_survey_ret_stat_from_setting(GHashTable *hash_table, gchar *name) { diff --git a/remmina/src/remmina_survey.h b/remmina/src/remmina_survey.h index da21602e9e..19cd0d67c0 100644 --- a/remmina/src/remmina_survey.h +++ b/remmina/src/remmina_survey.h @@ -45,6 +45,7 @@ typedef struct _RemminaSurveyDialog G_BEGIN_DECLS +gboolean remmina_survey_valid_profile(); void remmina_survey_on_startup(GtkWindow *parent); gboolean remmina_survey_cb(gpointer data); void remmina_survey_start(); From be2c4582df6e21f4840d5dbf3baa2486bda1cd05 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Wed, 20 Jan 2016 22:40:43 +0100 Subject: [PATCH 41/51] Git commit hash added to version Now remmina version show something like "1.2.0-rcgit.8 (git 194cc9d)" Having a git commit id helps to identify builds and eases debuggin. The downside is that GetGitRevisionDescription retriggers a cmake re-configuration after each git commit. But thats the only way to get correct version informations without having git hooks or similar. GetGitRevisionDescription is based on Ryan Pavlik cmake Modules and @bmiklautz patch 32390d7 in FreeRDP --- CMakeLists.txt | 7 ++ cmake/GetGitRevisionDescription.cmake | 135 +++++++++++++++++++++++ cmake/GetGitRevisionDescription.cmake.in | 38 +++++++ config.h.in | 2 + remmina/src/remmina.c | 2 +- remmina/src/remmina_about.c | 5 +- 6 files changed, 187 insertions(+), 2 deletions(-) create mode 100644 cmake/GetGitRevisionDescription.cmake create mode 100644 cmake/GetGitRevisionDescription.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt index c3f5eb6541..c33f3a2c42 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -102,6 +102,13 @@ set(REMMINA_VERSION_REVISION "0") set(REMMINA_VERSION_SUFFIX "rcgit.8") set(REMMINA_VERSION "${REMMINA_VERSION_MAJOR}.${REMMINA_VERSION_MINOR}.${REMMINA_VERSION_REVISION}-${REMMINA_VERSION_SUFFIX}") +include(GetGitRevisionDescription) +git_get_exact_tag(GIT_REVISION --tags --always) +if (${GIT_REVISION} STREQUAL "n/a") + git_rev_parse(GIT_REVISION --short) +endif() +message(STATUS "Git Revision ${GIT_REVISION}") + set(REMMINA_DATADIR "${CMAKE_INSTALL_FULL_DATADIR}") set(REMMINA_LOCALEDIR "${CMAKE_INSTALL_FULL_DATADIR}/locale") set(REMMINA_PLUGINDIR "${CMAKE_INSTALL_FULL_LIBDIR}/remmina/plugins") diff --git a/cmake/GetGitRevisionDescription.cmake b/cmake/GetGitRevisionDescription.cmake new file mode 100644 index 0000000000..432149d306 --- /dev/null +++ b/cmake/GetGitRevisionDescription.cmake @@ -0,0 +1,135 @@ +# - Returns a version string from Git +# +# These functions force a re-configure on each git commit so that you can +# trust the values of the variables in your build system. +# +# get_git_head_revision( [ ...]) +# +# Returns the refspec and sha hash of the current head revision +# +# git_describe( [ ...]) +# +# Returns the results of git describe on the source tree, and adjusting +# the output so that it tests false if an error occurs. +# +# git_get_exact_tag( [ ...]) +# +# Returns the results of git describe --exact-match on the source tree, +# and adjusting the output so that it tests false if there was no exact +# matching tag. +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(__get_git_revision_description) + return() +endif() +set(__get_git_revision_description YES) + +# We must run the following at "include" time, not at function call time, +# to find the path to this module rather than the path to a calling list file +get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH) + +function(get_git_head_revision _refspecvar _hashvar) + + set(GIT_PARENT_DIR "${CMAKE_SOURCE_DIR}") + set(GIT_DIR "${GIT_PARENT_DIR}/.git") + while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories + set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}") + get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH) + if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT) + # We have reached the root directory, we are not in git + set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE) + set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE) + return() + endif() + set(GIT_DIR "${GIT_PARENT_DIR}/.git") + endwhile() + set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data") + if(NOT EXISTS "${GIT_DATA}") + file(MAKE_DIRECTORY "${GIT_DATA}") + endif() + + if(NOT EXISTS "${GIT_DIR}/HEAD") + return() + endif() + set(HEAD_FILE "${GIT_DATA}/HEAD") + configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY) + + configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in" + "${GIT_DATA}/grabRef.cmake" + @ONLY) + include("${GIT_DATA}/grabRef.cmake") + + set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE) + set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE) +endfunction() + +function(git_rev_parse _var) + if(NOT GIT_FOUND) + find_package(Git QUIET) + endif() + if(NOT GIT_FOUND) + set(${_var} "n/a" PARENT_SCOPE) + return() + endif() + get_git_head_revision(refspec hash) + if(NOT hash) + set(${_var} "n/a" PARENT_SCOPE) + return() + endif() + + execute_process(COMMAND "${GIT_EXECUTABLE}" rev-parse ${ARGN} ${hash} + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + RESULT_VARIABLE res + OUTPUT_VARIABLE out + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(NOT res EQUAL 0) + set(out "n/a") + endif() + + set(${_var} "${out}" PARENT_SCOPE) +endfunction() + + +function(git_describe _var) + if(NOT GIT_FOUND) + find_package(Git QUIET) + endif() + if(NOT GIT_FOUND) + set(${_var} "n/a" PARENT_SCOPE) + return() + endif() + get_git_head_revision(refspec hash) + if(NOT hash) + set(${_var} "n/a" PARENT_SCOPE) + return() + endif() + + execute_process(COMMAND "${GIT_EXECUTABLE}" describe ${hash} ${ARGN} + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + RESULT_VARIABLE res + OUTPUT_VARIABLE out + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(NOT res EQUAL 0) + set(out "n/a") + endif() + + set(${_var} "${out}" PARENT_SCOPE) +endfunction() + +function(git_get_exact_tag _var) + git_describe(out --exact-match ${ARGN}) + set(${_var} "${out}" PARENT_SCOPE) +endfunction() diff --git a/cmake/GetGitRevisionDescription.cmake.in b/cmake/GetGitRevisionDescription.cmake.in new file mode 100644 index 0000000000..888ce13aab --- /dev/null +++ b/cmake/GetGitRevisionDescription.cmake.in @@ -0,0 +1,38 @@ +# +# Internal file for GetGitRevisionDescription.cmake +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +set(HEAD_HASH) + +file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024) + +string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS) +if(HEAD_CONTENTS MATCHES "ref") + # named branch + string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}") + if(EXISTS "@GIT_DIR@/${HEAD_REF}") + configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) + elseif(EXISTS "@GIT_DIR@/logs/${HEAD_REF}") + configure_file("@GIT_DIR@/logs/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) + set(HEAD_HASH "${HEAD_REF}") + endif() +else() + # detached HEAD + configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY) +endif() + +if(NOT HEAD_HASH) + file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024) + string(STRIP "${HEAD_HASH}" HEAD_HASH) +endif() diff --git a/config.h.in b/config.h.in index 385d47ed6d..e753644191 100644 --- a/config.h.in +++ b/config.h.in @@ -16,6 +16,8 @@ #define remmina "remmina" #define VERSION "${REMMINA_VERSION}" +#define GIT_REVISION "${GIT_REVISION}" + #define GETTEXT_PACKAGE remmina #define REMMINA_DATADIR "${REMMINA_DATADIR}" diff --git a/remmina/src/remmina.c b/remmina/src/remmina.c index 70331cae49..a1c6ebdb93 100644 --- a/remmina/src/remmina.c +++ b/remmina/src/remmina.c @@ -137,7 +137,7 @@ static gint remmina_on_command_line(GApplication *app, GApplicationCommandLine * if (remmina_option_version) { - g_print ("%s - Version %s\n", g_get_application_name (), VERSION); + g_print ("%s - Version %s (git %s)\n", g_get_application_name (), VERSION, GIT_REVISION); executed = TRUE; status = 1; } diff --git a/remmina/src/remmina_about.c b/remmina/src/remmina_about.c index 91e62705f7..8a12b41269 100644 --- a/remmina/src/remmina_about.c +++ b/remmina/src/remmina_about.c @@ -44,10 +44,13 @@ void remmina_about_open(GtkWindow *parent) { TRACE_CALL("remmina_about_open"); + static gchar version[32]; + + g_snprintf(version, sizeof(version), "%s (git %s)", VERSION, GIT_REVISION); GtkBuilder *builder = remmina_public_gtk_builder_new_from_file("remmina_about.glade"); GtkDialog *dialog = GTK_DIALOG (gtk_builder_get_object(builder, "dialog_remmina_about")); - gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(dialog), VERSION); + gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(dialog), version); gtk_about_dialog_set_translator_credits(GTK_ABOUT_DIALOG(dialog), _("translator-credits")); if (parent) From 200936bd95ce075903154670dadfcfe0bce404d9 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Wed, 20 Jan 2016 22:56:39 +0100 Subject: [PATCH 42/51] version command line option now open About dialog if remmina is active --- remmina/src/remmina.c | 3 ++- remmina/src/remmina_exec.c | 12 ++++++++++++ remmina/src/remmina_exec.h | 17 +++++++++-------- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/remmina/src/remmina.c b/remmina/src/remmina.c index a1c6ebdb93..a60944c899 100644 --- a/remmina/src/remmina.c +++ b/remmina/src/remmina.c @@ -137,7 +137,8 @@ static gint remmina_on_command_line(GApplication *app, GApplicationCommandLine * if (remmina_option_version) { - g_print ("%s - Version %s (git %s)\n", g_get_application_name (), VERSION, GIT_REVISION); + //g_print ("%s - Version %s (git %s)\n", g_get_application_name (), VERSION, GIT_REVISION); + remmina_exec_command(REMMINA_COMMAND_VERSION, NULL); executed = TRUE; status = 1; } diff --git a/remmina/src/remmina_exec.c b/remmina/src/remmina_exec.c index 1514534b8a..ff54f0d98f 100644 --- a/remmina/src/remmina_exec.c +++ b/remmina/src/remmina_exec.c @@ -154,6 +154,18 @@ void remmina_exec_command(RemminaCommandType command, const gchar* data) remmina_about_open(NULL); break; + case REMMINA_COMMAND_VERSION: + mainwindow = remmina_main_get_window(); + if (mainwindow) + { + remmina_about_open(NULL); + } + else + { + g_print ("%s - Version %s (git %s)\n", g_get_application_name (), VERSION, GIT_REVISION); + } + break; + case REMMINA_COMMAND_PLUGIN: plugin = (RemminaEntryPlugin*) remmina_plugin_manager_get_plugin(REMMINA_PLUGIN_TYPE_ENTRY, data); if (plugin) diff --git a/remmina/src/remmina_exec.h b/remmina/src/remmina_exec.h index d71ecd24e3..778d804350 100644 --- a/remmina/src/remmina_exec.h +++ b/remmina/src/remmina_exec.h @@ -39,15 +39,16 @@ G_BEGIN_DECLS typedef enum { - REMMINA_COMMAND_NONE = 0, - REMMINA_COMMAND_MAIN = 1, - REMMINA_COMMAND_PREF = 2, - REMMINA_COMMAND_NEW = 3, + REMMINA_COMMAND_NONE = 0, + REMMINA_COMMAND_MAIN = 1, + REMMINA_COMMAND_PREF = 2, + REMMINA_COMMAND_NEW = 3, REMMINA_COMMAND_CONNECT = 4, - REMMINA_COMMAND_EDIT = 5, - REMMINA_COMMAND_ABOUT = 6, - REMMINA_COMMAND_PLUGIN = 7, - REMMINA_COMMAND_EXIT = 8 + REMMINA_COMMAND_EDIT = 5, + REMMINA_COMMAND_ABOUT = 6, + REMMINA_COMMAND_VERSION = 7, + REMMINA_COMMAND_PLUGIN = 8, + REMMINA_COMMAND_EXIT = 9 } RemminaCommandType; void remmina_exec_command(RemminaCommandType command, const gchar* data); From a7dc4f879d78b6444c33df52161777631f72182a Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Wed, 20 Jan 2016 23:02:40 +0100 Subject: [PATCH 43/51] added build directory to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index e76c700b7e..0a4bfbfb14 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ Makefile.in _configs.sed aclocal.m4 autom4te.cache +build cmake_install.cmake cmake_uninstall.cmake config.guess From 23be0c66fb28a71cc3e3f9c4da3978b39af9f264 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Thu, 21 Jan 2016 00:15:40 +0100 Subject: [PATCH 44/51] header sorting as per glib coding guidelines --- remmina/src/remmina_pref.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/remmina/src/remmina_pref.c b/remmina/src/remmina_pref.c index 0b4b38437c..f6b1778802 100644 --- a/remmina/src/remmina_pref.c +++ b/remmina/src/remmina_pref.c @@ -33,12 +33,15 @@ * */ -#include -#include +#include "config.h" + #include #include #include -#include "config.h" + +#include +#include + #include "remmina_public.h" #include "remmina_string_array.h" #include "remmina_pref.h" From af682607c391b3f17dbc38db2d9d82fc6c19d990 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Thu, 21 Jan 2016 00:39:59 +0100 Subject: [PATCH 45/51] header sort as per glib cod. guidelines --- remmina/src/remmina_survey.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/remmina/src/remmina_survey.c b/remmina/src/remmina_survey.c index b51984ce68..60eb9d354b 100644 --- a/remmina/src/remmina_survey.c +++ b/remmina/src/remmina_survey.c @@ -33,6 +33,8 @@ * */ +#include "config.h" + #include #include #include @@ -44,7 +46,7 @@ #include #include #include -#include "config.h" + #include "remmina_file.h" #include "remmina_pref.h" #include "remmina_public.h" From 5b158e679b427aea169795a0d66a9db1e781b190 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Thu, 21 Jan 2016 01:41:29 +0100 Subject: [PATCH 46/51] Date implementation --- remmina/src/remmina_pref.c | 36 ++++++++++++++++++++++++++++++++++++ remmina/src/remmina_pref.h | 3 +++ remmina/src/remmina_survey.c | 33 ++++++++++++++++++++++++++++++++- 3 files changed, 71 insertions(+), 1 deletion(-) diff --git a/remmina/src/remmina_pref.c b/remmina/src/remmina_pref.c index f6b1778802..0a0c7bc028 100644 --- a/remmina/src/remmina_pref.c +++ b/remmina/src/remmina_pref.c @@ -37,6 +37,8 @@ #include #include +#include +#include #include #include @@ -135,6 +137,32 @@ static void remmina_pref_gen_uid(void) } +/* used to save the current date the first time we execute remmina */ +static void remmina_pref_birthday(void) +{ + TRACE_CALL("remmina_pref_birthday"); + GKeyFile *gkeyfile; + gchar bdate[11]; + gchar *content; + gsize length; + + GDate *today = g_date_new(); + g_date_set_time_t(today, time(NULL)); + g_date_strftime(bdate, sizeof(bdate), "%d/%m/%Y", today); + g_date_free(today); + + remmina_pref.bdate = g_strdup(bdate); + + gkeyfile = g_key_file_new(); + g_key_file_load_from_file(gkeyfile, remmina_pref_file, G_KEY_FILE_NONE, NULL); + g_key_file_set_string(gkeyfile, "remmina_pref", "bdate", remmina_pref.bdate); + content = g_key_file_to_data(gkeyfile, &length, NULL); + g_file_set_contents(remmina_pref_file, content, length, NULL); + + g_key_file_free(gkeyfile); + g_free(content); +} + static guint remmina_pref_get_keyval_from_str(const gchar *str) { TRACE_CALL("remmina_pref_get_keyval_from_str"); @@ -505,6 +533,11 @@ void remmina_pref_init(void) else remmina_pref.uid = NULL; + if (g_key_file_has_key(gkeyfile, "remmina_pref", "bdate", NULL)) + remmina_pref.bdate = g_key_file_get_string(gkeyfile, "remmina_pref", "bdate", NULL); + else + remmina_pref.bdate = NULL; + if (g_key_file_has_key(gkeyfile, "remmina_pref", "vte_font", NULL)) remmina_pref.vte_font = g_key_file_get_string(gkeyfile, "remmina_pref", "vte_font", NULL); else @@ -556,6 +589,9 @@ void remmina_pref_init(void) if (remmina_pref.uid == NULL) remmina_pref_gen_uid(); + if (remmina_pref.bdate == NULL) + remmina_pref_birthday(); + remmina_pref_init_keymap(); } diff --git a/remmina/src/remmina_pref.h b/remmina/src/remmina_pref.h index 019b9c9790..2996300d3a 100644 --- a/remmina/src/remmina_pref.h +++ b/remmina/src/remmina_pref.h @@ -157,6 +157,9 @@ typedef struct _RemminaPref /* UID */ gchar *uid; + + /* Remmina birthday */ + const gchar *bdate; } RemminaPref; #define DEFAULT_SSH_PARSECONFIG TRUE diff --git a/remmina/src/remmina_survey.c b/remmina/src/remmina_survey.c index 60eb9d354b..845c9ab86b 100644 --- a/remmina/src/remmina_survey.c +++ b/remmina/src/remmina_survey.c @@ -45,6 +45,9 @@ #include #include #include +#include +#include +#include #include #include "remmina_file.h" @@ -162,6 +165,17 @@ static const gchar *remmina_get_datadir() return remdir; } +gint remmina_survey_diff_date(GDate *date) +{ + GDate *today = g_date_new(); + g_date_set_time_t(today, time(NULL)); + + int days_diff = g_date_days_between(date, today); + g_date_free(today); + + return days_diff; +} + /* At least one .remmina file */ gboolean remmina_survey_valid_profile() { @@ -172,8 +186,12 @@ gboolean remmina_survey_valid_profile() GError *gerror = NULL; gchar filename[PATH_MAX]; const gchar *dir_entry; + GDate *date = g_date_new(); + gboolean ismature = FALSE; + gint count_profile=0; - gint min_profiles=1; /* Use a constant */ + gint min_profiles=1; /* TODO: Use a constant */ + gint min_days = 30; /* TODO: Use a constant */ g_snprintf(remdir, sizeof(remdir), "%s/.%s", g_get_home_dir(), "remmina"); dir = g_dir_open(remdir, 0, &gerror); @@ -196,6 +214,19 @@ gboolean remmina_survey_valid_profile() } g_dir_close(dir); } + + g_date_set_parse(date, remmina_pref.bdate); + if (!g_date_valid(date)) + { + g_print("%s failed.\n", remmina_pref.bdate); + } + + if (remmina_survey_diff_date(date) >= min_days) + ismature=TRUE; + + g_free(date); + + //return (count_profile >= min_profiles && ismature); return (count_profile >= min_profiles); } From 95a919ed6a81a0fe6307bd39c63939c52c21a452 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Thu, 21 Jan 2016 11:58:23 +0100 Subject: [PATCH 47/51] fixed date format, to be tested with other locale --- remmina/src/remmina_pref.c | 7 +++++-- remmina/src/remmina_survey.c | 9 ++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/remmina/src/remmina_pref.c b/remmina/src/remmina_pref.c index 0a0c7bc028..8411d06e0f 100644 --- a/remmina/src/remmina_pref.c +++ b/remmina/src/remmina_pref.c @@ -142,13 +142,16 @@ static void remmina_pref_birthday(void) { TRACE_CALL("remmina_pref_birthday"); GKeyFile *gkeyfile; - gchar bdate[11]; + gchar *bdate; gchar *content; gsize length; GDate *today = g_date_new(); g_date_set_time_t(today, time(NULL)); - g_date_strftime(bdate, sizeof(bdate), "%d/%m/%Y", today); + bdate = g_strdup_printf ( "%d/%d/%d", + g_date_get_year (today), + g_date_get_month (today), + g_date_get_day (today)); g_date_free(today); remmina_pref.bdate = g_strdup(bdate); diff --git a/remmina/src/remmina_survey.c b/remmina/src/remmina_survey.c index 845c9ab86b..9a6126c24d 100644 --- a/remmina/src/remmina_survey.c +++ b/remmina/src/remmina_survey.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -215,19 +216,17 @@ gboolean remmina_survey_valid_profile() g_dir_close(dir); } - g_date_set_parse(date, remmina_pref.bdate); + g_date_set_parse(date, g_strdup_printf("%s", remmina_pref.bdate)); if (!g_date_valid(date)) - { g_print("%s failed.\n", remmina_pref.bdate); - } if (remmina_survey_diff_date(date) >= min_days) ismature=TRUE; g_free(date); - //return (count_profile >= min_profiles && ismature); - return (count_profile >= min_profiles); + return (count_profile >= min_profiles && ismature); + //return (count_profile >= min_profiles); } /* Insert setting name and its count in an hashtable */ From ddfdbd3d06f7d36376ec97c3770db755fbe0f8a1 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Thu, 21 Jan 2016 14:12:58 +0100 Subject: [PATCH 48/51] Using julian date to avoid locale issues --- remmina/src/remmina_pref.c | 19 +++++++------------ remmina/src/remmina_pref.h | 4 ++-- remmina/src/remmina_survey.c | 7 ++++--- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/remmina/src/remmina_pref.c b/remmina/src/remmina_pref.c index 8411d06e0f..ef2a9372c2 100644 --- a/remmina/src/remmina_pref.c +++ b/remmina/src/remmina_pref.c @@ -142,23 +142,18 @@ static void remmina_pref_birthday(void) { TRACE_CALL("remmina_pref_birthday"); GKeyFile *gkeyfile; - gchar *bdate; gchar *content; gsize length; GDate *today = g_date_new(); g_date_set_time_t(today, time(NULL)); - bdate = g_strdup_printf ( "%d/%d/%d", - g_date_get_year (today), - g_date_get_month (today), - g_date_get_day (today)); - g_date_free(today); + remmina_pref.bdate = g_date_get_julian(today); - remmina_pref.bdate = g_strdup(bdate); + g_date_free(today); gkeyfile = g_key_file_new(); g_key_file_load_from_file(gkeyfile, remmina_pref_file, G_KEY_FILE_NONE, NULL); - g_key_file_set_string(gkeyfile, "remmina_pref", "bdate", remmina_pref.bdate); + g_key_file_set_integer(gkeyfile, "remmina_pref", "bdate", remmina_pref.bdate); content = g_key_file_to_data(gkeyfile, &length, NULL); g_file_set_contents(remmina_pref_file, content, length, NULL); @@ -537,14 +532,14 @@ void remmina_pref_init(void) remmina_pref.uid = NULL; if (g_key_file_has_key(gkeyfile, "remmina_pref", "bdate", NULL)) - remmina_pref.bdate = g_key_file_get_string(gkeyfile, "remmina_pref", "bdate", NULL); + remmina_pref.bdate = g_key_file_get_integer(gkeyfile, "remmina_pref", "bdate", NULL); else - remmina_pref.bdate = NULL; + remmina_pref.bdate = 0; if (g_key_file_has_key(gkeyfile, "remmina_pref", "vte_font", NULL)) remmina_pref.vte_font = g_key_file_get_string(gkeyfile, "remmina_pref", "vte_font", NULL); else - remmina_pref.vte_font = NULL; + remmina_pref.vte_font = 0; 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", @@ -592,7 +587,7 @@ void remmina_pref_init(void) if (remmina_pref.uid == NULL) remmina_pref_gen_uid(); - if (remmina_pref.bdate == NULL) + if (remmina_pref.bdate == 0) remmina_pref_birthday(); remmina_pref_init_keymap(); diff --git a/remmina/src/remmina_pref.h b/remmina/src/remmina_pref.h index 2996300d3a..8e6f97d2d9 100644 --- a/remmina/src/remmina_pref.h +++ b/remmina/src/remmina_pref.h @@ -158,8 +158,8 @@ typedef struct _RemminaPref /* UID */ gchar *uid; - /* Remmina birthday */ - const gchar *bdate; + /* Remmina birthday julian format*/ + guint32 bdate; } RemminaPref; #define DEFAULT_SSH_PARSECONFIG TRUE diff --git a/remmina/src/remmina_survey.c b/remmina/src/remmina_survey.c index 9a6126c24d..19a994afe3 100644 --- a/remmina/src/remmina_survey.c +++ b/remmina/src/remmina_survey.c @@ -187,7 +187,7 @@ gboolean remmina_survey_valid_profile() GError *gerror = NULL; gchar filename[PATH_MAX]; const gchar *dir_entry; - GDate *date = g_date_new(); + GDate *date; gboolean ismature = FALSE; gint count_profile=0; @@ -216,9 +216,10 @@ gboolean remmina_survey_valid_profile() g_dir_close(dir); } - g_date_set_parse(date, g_strdup_printf("%s", remmina_pref.bdate)); + + date = g_date_new_julian(remmina_pref.bdate); if (!g_date_valid(date)) - g_print("%s failed.\n", remmina_pref.bdate); + g_print("%d failed.\n", remmina_pref.bdate); if (remmina_survey_diff_date(date) >= min_days) ismature=TRUE; From dbd4752bd9d12fc27b277276f6e212c64a1162c2 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Fri, 22 Jan 2016 09:44:24 +0100 Subject: [PATCH 49/51] libssh and gdk_cursor deprecations warning --- remmina-plugins/nx/nx_session.c | 12 ++++++++++++ remmina-plugins/rdp/rdp_event.c | 2 +- remmina/src/remmina_sftp_client.c | 4 ++-- remmina/src/remmina_ssh.c | 8 ++++++++ 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/remmina-plugins/nx/nx_session.c b/remmina-plugins/nx/nx_session.c index 6625ba8c66..8f11cff3d9 100644 --- a/remmina-plugins/nx/nx_session.c +++ b/remmina-plugins/nx/nx_session.c @@ -281,17 +281,23 @@ static gboolean remmina_nx_session_get_response(RemminaNXSession *nx) if (is_stderr > 1) return FALSE; + G_GNUC_BEGIN_IGNORE_DEPRECATIONS buffer = buffer_new(); len = channel_read_buffer(nx->channel, buffer, len, is_stderr); + G_GNUC_END_IGNORE_DEPRECATIONS if (len <= 0) { remmina_nx_session_set_application_error(nx, "Channel closed."); return FALSE; } if (len > 0) { + G_GNUC_BEGIN_IGNORE_DEPRECATIONS g_string_append_len(nx->response, (const gchar*) buffer_get(buffer), len); + G_GNUC_END_IGNORE_DEPRECATIONS } + G_GNUC_BEGIN_IGNORE_DEPRECATIONS buffer_free(buffer); + G_GNUC_END_IGNORE_DEPRECATIONS return TRUE; } @@ -826,7 +832,9 @@ static gpointer remmina_nx_session_tunnel_main_thread(gpointer data) else if (len > 0) { 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); + G_GNUC_END_IGNORE_DEPRECATIONS if (lenw <= 0) { nx->running = FALSE; break; @@ -839,7 +847,9 @@ static gpointer remmina_nx_session_tunnel_main_thread(gpointer data) break; if (channels_out[0] && socketbuffer_len <= 0) { + G_GNUC_BEGIN_IGNORE_DEPRECATIONS len = channel_read_nonblocking(channels_out[0], socketbuffer, sizeof(socketbuffer), 0); + G_GNUC_END_IGNORE_DEPRECATIONS if (len == SSH_ERROR || len == SSH_EOF) { nx->running = FALSE; break; @@ -848,7 +858,9 @@ static gpointer remmina_nx_session_tunnel_main_thread(gpointer data) socketbuffer_len = len; } else { /* 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); + G_GNUC_END_IGNORE_DEPRECATIONS } } diff --git a/remmina-plugins/rdp/rdp_event.c b/remmina-plugins/rdp/rdp_event.c index f6cd72a8c4..331139411e 100644 --- a/remmina-plugins/rdp/rdp_event.c +++ b/remmina-plugins/rdp/rdp_event.c @@ -831,7 +831,7 @@ static void remmina_rdp_event_cursor(RemminaProtocolWidget* gp, RemminaPluginRdp break; case REMMINA_RDP_POINTER_NULL: - gdk_window_set_cursor(gtk_widget_get_window(rfi->drawing_area), gdk_cursor_new(GDK_BLANK_CURSOR)); + gdk_window_set_cursor(gtk_widget_get_window(rfi->drawing_area), gdk_cursor_new_for_display(gdk_display_get_default(), GDK_BLANK_CURSOR)); ui->retval = 1; break; diff --git a/remmina/src/remmina_sftp_client.c b/remmina/src/remmina_sftp_client.c index a4b672b11e..3ba43020d7 100644 --- a/remmina/src/remmina_sftp_client.c +++ b/remmina/src/remmina_sftp_client.c @@ -954,7 +954,7 @@ static gboolean remmina_sftp_client_refresh (RemminaSFTPClient *client) { TRACE_CALL("remmina_sftp_client_refresh"); - SET_CURSOR (gdk_cursor_new (GDK_WATCH)); + SET_CURSOR (gdk_cursor_new_for_display(gdk_display_get_default(), GDK_WATCH)); gdk_flush (); remmina_sftp_client_on_opendir (client, ".", NULL); @@ -1070,7 +1070,7 @@ remmina_sftp_client_new_init (RemminaSFTP *sftp) client = remmina_sftp_client_new (); - SET_CURSOR (gdk_cursor_new (GDK_WATCH)); + SET_CURSOR (gdk_cursor_new_for_display(gdk_display_get_default(), GDK_WATCH)); gdk_flush (); if (!remmina_ssh_init_session (REMMINA_SSH (sftp)) || diff --git a/remmina/src/remmina_ssh.c b/remmina/src/remmina_ssh.c index 3a6a099445..65c29b356a 100644 --- a/remmina/src/remmina_ssh.c +++ b/remmina/src/remmina_ssh.c @@ -821,6 +821,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++) { + G_GNUC_BEGIN_IGNORE_DEPRECATIONS if (ssh_forward_listen (REMMINA_SSH (tunnel)->session, (tunnel->bindlocalhost ? "localhost" : NULL), 6000 + i, NULL)) { continue; @@ -830,6 +831,7 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) tunnel->remotedisplay = i; break; } + G_GNUC_END_IGNORE_DEPRECATIONS } if (tunnel->remotedisplay < 1) { @@ -856,8 +858,10 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) break; case REMMINA_SSH_TUNNEL_REVERSE: + G_GNUC_BEGIN_IGNORE_DEPRECATIONS if (ssh_forward_listen (REMMINA_SSH (tunnel)->session, NULL, tunnel->port, NULL)) { + G_GNUC_END_IGNORE_DEPRECATIONS remmina_ssh_set_error (REMMINA_SSH (tunnel), _("Failed to request port forwarding : %s")); if (tunnel->disconnect_func) { @@ -919,8 +923,10 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) } if (tunnel->tunnel_type == REMMINA_SSH_TUNNEL_REVERSE) { + G_GNUC_BEGIN_IGNORE_DEPRECATIONS /* For reverse tunnel, we only need one connection. */ ssh_forward_cancel (REMMINA_SSH (tunnel)->session, NULL, tunnel->port); + G_GNUC_END_IGNORE_DEPRECATIONS } } else if (tunnel->tunnel_type != REMMINA_SSH_TUNNEL_REVERSE) @@ -1262,7 +1268,9 @@ remmina_ssh_tunnel_free (RemminaSSHTunnel* tunnel) if (tunnel->tunnel_type == REMMINA_SSH_TUNNEL_XPORT && tunnel->remotedisplay > 0) { + G_GNUC_BEGIN_IGNORE_DEPRECATIONS ssh_forward_cancel (REMMINA_SSH (tunnel)->session, NULL, 6000 + tunnel->remotedisplay); + G_GNUC_END_IGNORE_DEPRECATIONS } if (tunnel->server_sock >= 0) { From f2dec07cdf616734c85e00d00c1c519a1f81bc06 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Fri, 22 Jan 2016 09:52:06 +0100 Subject: [PATCH 50/51] Do not use deprecated gtk_style_context_get_background_color () --- 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 8a3aef7e18..4981a94e2e 100644 --- a/remmina/src/remmina_ssh_plugin.c +++ b/remmina/src/remmina_ssh_plugin.c @@ -271,7 +271,7 @@ remmina_plugin_ssh_init (RemminaProtocolWidget *gp) /* Get default system theme colors */ style_context = gtk_widget_get_style_context(GTK_WIDGET (vte)); gtk_style_context_get_color(style_context, GTK_STATE_FLAG_NORMAL, &foreground_color); - gtk_style_context_get_background_color(style_context, GTK_STATE_FLAG_NORMAL, &background_color); + gtk_style_context_get(style_context, GTK_STATE_FLAG_NORMAL, "background-color", &background_color, NULL); } else { From 621981b613bf00dd3eae7149ec72c44e147dad19 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Fri, 22 Jan 2016 11:12:59 +0100 Subject: [PATCH 51/51] Setting survey to FALSE --- remmina/src/remmina_exec.c | 2 +- remmina/src/remmina_pref.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/remmina/src/remmina_exec.c b/remmina/src/remmina_exec.c index ff54f0d98f..a10d7d1f6e 100644 --- a/remmina/src/remmina_exec.c +++ b/remmina/src/remmina_exec.c @@ -82,7 +82,7 @@ void remmina_exec_command(RemminaCommandType command, const gchar* data) GtkWindow* mainwindow; GtkDialog* prefdialog; RemminaEntryPlugin* plugin; - static gboolean remmina_survey = TRUE; + static gboolean remmina_survey = FALSE; switch (command) { diff --git a/remmina/src/remmina_pref.c b/remmina/src/remmina_pref.c index ef2a9372c2..1ccc92da7f 100644 --- a/remmina/src/remmina_pref.c +++ b/remmina/src/remmina_pref.c @@ -272,7 +272,7 @@ void remmina_pref_init(void) if (g_key_file_has_key(gkeyfile, "remmina_pref", "survey", NULL)) remmina_pref.survey = g_key_file_get_boolean(gkeyfile, "remmina_pref", "survey", NULL); else - remmina_pref.survey = TRUE; + remmina_pref.survey = FALSE; if (g_key_file_has_key(gkeyfile, "remmina_pref", "invisible_toolbar", NULL)) remmina_pref.invisible_toolbar = g_key_file_get_boolean(gkeyfile, "remmina_pref", "invisible_toolbar", NULL);