diff options
author | Antenore Gatta <antenore@simbiosi.org> | 2020-11-26 15:43:16 +0300 |
---|---|---|
committer | Antenore Gatta <antenore@simbiosi.org> | 2020-11-26 15:43:16 +0300 |
commit | 3d66abc80c423794f38d279aefaf30cb5fd5f8c6 (patch) | |
tree | 71a9d7cbb18a1b03b599319b9320371ba781ab2f | |
parent | b1860040fa4c6ad98fcba9ba8c2ab017f417179c (diff) |
Automatically accept changes to fingerprints and certificates
Signed-off-by: Antenore Gatta <antenore@simbiosi.org>
-rw-r--r-- | data/ui/remmina_main.glade | 207 | ||||
-rw-r--r-- | data/ui/remmina_preferences.glade | 86 | ||||
-rw-r--r-- | src/remmina_main.c | 31 | ||||
-rw-r--r-- | src/remmina_pref.c | 5 | ||||
-rw-r--r-- | src/remmina_pref.h | 10 | ||||
-rw-r--r-- | src/remmina_pref_dialog.c | 3 | ||||
-rw-r--r-- | src/remmina_pref_dialog.h | 1 | ||||
-rw-r--r-- | src/remmina_protocol_widget.c | 12 | ||||
-rw-r--r-- | src/remmina_public.c | 21 |
9 files changed, 246 insertions, 130 deletions
diff --git a/data/ui/remmina_main.glade b/data/ui/remmina_main.glade index 703098b93..4879be6d9 100644 --- a/data/ui/remmina_main.glade +++ b/data/ui/remmina_main.glade @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.22.2 +<!-- Generated with glade 3.36.0 Remmina - The GTK+ Remmina Remote Desktop Client Copyright (C) Antenore Gatta & Giovanni Panozzo 2014-2020 @@ -62,96 +62,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. <signal name="drag-data-received" handler="remmina_main_on_drag_data_received" swapped="no"/> <signal name="show" handler="remmina_main_on_show" swapped="no"/> <signal name="window-state-event" handler="remmina_main_on_window_state_event" swapped="no"/> - <child type="titlebar"> - <object class="GtkHeaderBar" id="main_headerbar"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="title">Remmina</property> - <property name="subtitle" translatable="yes">Remote Desktop Client</property> - <property name="spacing">10</property> - <property name="show_close_button">True</property> - <child> - <object class="GtkButton" id="button_new"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">New connection profile</property> - <property name="halign">start</property> - <property name="image">image_new</property> - <property name="always_show_image">True</property> - <signal name="clicked" handler="remmina_main_on_action_connection_new" swapped="no"/> - </object> - </child> - <child> - <object class="GtkToggleButton" id="search_toggle"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Show search bar</property> - <property name="image">find_toggle_image</property> - <property name="active">True</property> - <signal name="toggled" handler="remmina_main_on_search_toggle" swapped="no"/> - </object> - <packing> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkButton" id="button_news"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="action_name">main.news</property> - <property name="image">image_news</property> - <property name="always_show_image">True</property> - </object> - <packing> - <property name="position">3</property> - </packing> - </child> - <child> - <object class="GtkMenuButton" id="menu_header_button"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="popup">menu_popup_full</property> - <property name="use_popover">False</property> - <child> - <object class="GtkImage" id="image_menu"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="tooltip_text" translatable="yes">Remmina main menu</property> - <property name="icon_name">open-menu-symbolic</property> - <property name="icon_size">1</property> - </object> - </child> - <child internal-child="accessible"> - <object class="AtkObject" id="menu_header_button-atkobject"> - <property name="AtkObject::accessible-name" translatable="yes">Actions</property> - </object> - </child> - </object> - <packing> - <property name="pack_type">end</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkToggleButton" id="view_toggle_button"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Toggle view</property> - <property name="image">view_toggle_icon</property> - <signal name="toggled" handler="remmina_main_on_view_toggle" swapped="no"/> - </object> - <packing> - <property name="pack_type">end</property> - <property name="position">2</property> - </packing> - </child> - </object> - </child> <child> <object class="GtkBox" id="box_main"> <property name="visible">True</property> @@ -345,7 +255,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. <property name="visible">True</property> <property name="app_paintable">True</property> <property name="can_focus">False</property> - <property name="action_name">main.preferences</property> + <property name="action_name">app.preferences</property> + <property name="action_target">0</property> <property name="label" translatable="yes">_Preferences</property> <property name="use_underline">True</property> <accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/> @@ -356,7 +267,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. <property name="visible">True</property> <property name="app_paintable">True</property> <property name="can_focus">False</property> - <property name="action_name">main.mpchange</property> + <property name="action_name">app.mpchange</property> <property name="label" translatable="yes">Multi password changer</property> <property name="use_underline">True</property> </object> @@ -366,7 +277,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. <property name="visible">True</property> <property name="app_paintable">True</property> <property name="can_focus">False</property> - <property name="action_name">main.debug</property> + <property name="action_name">app.debug</property> <property name="label" translatable="yes">Debugging</property> <property name="use_underline">True</property> </object> @@ -396,7 +307,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. <property name="visible">True</property> <property name="app_paintable">True</property> <property name="can_focus">False</property> - <property name="action_name">main.news</property> + <property name="action_name">app.news</property> <property name="label" translatable="yes">News</property> <property name="use_underline">True</property> </object> @@ -406,7 +317,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. <property name="visible">True</property> <property name="app_paintable">True</property> <property name="can_focus">False</property> - <property name="action_name">main.default</property> + <property name="action_name">app.default</property> <property name="label" translatable="yes">Make Remmina your default remote desktop client</property> <property name="use_underline">True</property> </object> @@ -416,7 +327,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. <property name="visible">True</property> <property name="app_paintable">True</property> <property name="can_focus">False</property> - <property name="action_name">main.plugins</property> + <property name="action_name">app.plugins</property> <property name="label" translatable="yes">Plugins</property> <property name="use_underline">True</property> </object> @@ -433,7 +344,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. <property name="visible">True</property> <property name="app_paintable">True</property> <property name="can_focus">False</property> - <property name="action_name">main.homepage</property> + <property name="action_name">app.homepage</property> <property name="label" translatable="yes">Homepage</property> <property name="use_underline">True</property> </object> @@ -443,7 +354,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. <property name="visible">True</property> <property name="app_paintable">True</property> <property name="can_focus">False</property> - <property name="action_name">main.donations</property> + <property name="action_name">app.donations</property> <property name="label" translatable="yes">Donations</property> <property name="use_underline">True</property> </object> @@ -453,7 +364,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. <property name="visible">True</property> <property name="app_paintable">True</property> <property name="can_focus">False</property> - <property name="action_name">main.wiki</property> + <property name="action_name">app.wiki</property> <property name="label" translatable="yes">Wiki</property> <property name="use_underline">True</property> </object> @@ -463,7 +374,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. <property name="visible">True</property> <property name="app_paintable">True</property> <property name="can_focus">False</property> - <property name="action_name">main.community</property> + <property name="action_name">app.community</property> <property name="label" translatable="yes" comments="Remmina community website">Community</property> <property name="use_underline">True</property> </object> @@ -487,7 +398,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. <property name="visible">True</property> <property name="app_paintable">True</property> <property name="can_focus">False</property> - <property name="action_name">main.about</property> + <property name="action_name">app.about</property> <property name="label" translatable="yes">About</property> </object> </child> @@ -496,7 +407,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. <property name="visible">True</property> <property name="app_paintable">True</property> <property name="can_focus">False</property> - <property name="action_name">main.quit</property> + <property name="action_name">app.quit</property> <property name="label" translatable="yes">_Quit</property> <property name="use_underline">True</property> <accelerator key="q" signal="activate" modifiers="GDK_CONTROL_MASK"/> @@ -636,5 +547,95 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. </child> </object> </child> + <child type="titlebar"> + <object class="GtkHeaderBar" id="main_headerbar"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="title">Remmina</property> + <property name="subtitle" translatable="yes">Remote Desktop Client</property> + <property name="spacing">10</property> + <property name="show_close_button">True</property> + <child> + <object class="GtkButton" id="button_new"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">New connection profile</property> + <property name="halign">start</property> + <property name="action_name">main.new</property> + <property name="image">image_new</property> + <property name="always_show_image">True</property> + </object> + </child> + <child> + <object class="GtkMenuButton" id="menu_header_button"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="popup">menu_popup_full</property> + <property name="use_popover">False</property> + <child> + <object class="GtkImage" id="image_menu"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="tooltip_text" translatable="yes">Remmina main menu</property> + <property name="icon_name">open-menu-symbolic</property> + <property name="icon_size">1</property> + </object> + </child> + <child internal-child="accessible"> + <object class="AtkObject" id="menu_header_button-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes">Actions</property> + </object> + </child> + </object> + <packing> + <property name="pack_type">end</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkToggleButton" id="search_toggle"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Show search bar</property> + <property name="image">find_toggle_image</property> + <property name="active">True</property> + <signal name="toggled" handler="remmina_main_on_search_toggle" swapped="no"/> + </object> + <packing> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkToggleButton" id="view_toggle_button"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Toggle view</property> + <property name="image">view_toggle_icon</property> + <signal name="toggled" handler="remmina_main_on_view_toggle" swapped="no"/> + </object> + <packing> + <property name="pack_type">end</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkButton" id="button_news"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="action_name">app.news</property> + <property name="image">image_news</property> + <property name="always_show_image">True</property> + </object> + <packing> + <property name="position">3</property> + </packing> + </child> + </object> + </child> </object> </interface> diff --git a/data/ui/remmina_preferences.glade b/data/ui/remmina_preferences.glade index a2644020e..da153afa1 100644 --- a/data/ui/remmina_preferences.glade +++ b/data/ui/remmina_preferences.glade @@ -43,9 +43,6 @@ Author: Antenore Gatta <property name="type_hint">dialog</property> <signal name="close" handler="remmina_pref_dialog_on_close_clicked" swapped="no"/> <signal name="destroy" handler="remmina_pref_on_dialog_destroy" swapped="no"/> - <child type="titlebar"> - <placeholder/> - </child> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> <property name="can_focus">False</property> @@ -562,6 +559,7 @@ Author: Antenore Gatta <property name="label" translatable="yes">Options</property> </object> <packing> + <property name="menu_label">options</property> <property name="tab_fill">False</property> </packing> </child> @@ -751,6 +749,7 @@ Author: Antenore Gatta <property name="label" translatable="yes">Appearance</property> </object> <packing> + <property name="menu_label">appearance</property> <property name="position">1</property> <property name="tab_fill">False</property> </packing> @@ -862,6 +861,7 @@ Author: Antenore Gatta <property name="label" translatable="yes">Applet</property> </object> <packing> + <property name="menu_label">applet</property> <property name="position">2</property> <property name="tab_fill">False</property> </packing> @@ -1234,6 +1234,7 @@ Author: Antenore Gatta <property name="label" translatable="yes">Keyboard</property> </object> <packing> + <property name="menu_label">keyboard</property> <property name="position">3</property> <property name="tab_fill">False</property> </packing> @@ -1457,6 +1458,7 @@ Author: Antenore Gatta <property name="label" translatable="yes">SSH options</property> </object> <packing> + <property name="menu_label">ssh option</property> <property name="position">4</property> <property name="tab_fill">False</property> </packing> @@ -1472,7 +1474,7 @@ Author: Antenore Gatta <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">start</property> - <property name="margin_left">18</property> + <property name="margin_start">18</property> <property name="margin_top">18</property> <property name="margin_bottom">9</property> <property name="hexpand">False</property> @@ -1493,6 +1495,7 @@ Author: Antenore Gatta <property name="can_focus">True</property> <property name="tooltip_text" translatable="yes">Use secret key authentication for some widgets</property> <property name="halign">start</property> + <property name="margin_end">18</property> <property name="margin_top">9</property> <property name="margin_bottom">9</property> <property name="hexpand">True</property> @@ -1510,6 +1513,7 @@ Author: Antenore Gatta <property name="tooltip_text" translatable="yes">Use secret key authentication for some widgets</property> <property name="halign">start</property> <property name="margin_left">36</property> + <property name="margin_start">36</property> <property name="margin_top">9</property> <property name="margin_bottom">9</property> <property name="hexpand">True</property> @@ -1525,7 +1529,7 @@ Author: Antenore Gatta <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">start</property> - <property name="margin_left">36</property> + <property name="margin_start">36</property> <property name="label" translatable="yes">Automatic lock interval</property> </object> <packing> @@ -1539,7 +1543,9 @@ Author: Antenore Gatta <property name="can_focus">True</property> <property name="tooltip_text" translatable="yes">Master password validity in seconds</property> <property name="halign">start</property> - <property name="width_chars">9</property> + <property name="margin_end">18</property> + <property name="hexpand">True</property> + <property name="width_chars">24</property> <property name="text">300</property> <property name="input_purpose">number</property> </object> @@ -1554,7 +1560,7 @@ Author: Antenore Gatta <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">start</property> - <property name="margin_left">18</property> + <property name="margin_start">18</property> <property name="margin_top">9</property> <property name="hexpand">False</property> <property name="label" translatable="yes">File encryption</property> @@ -1564,7 +1570,7 @@ Author: Antenore Gatta </object> <packing> <property name="left_attach">0</property> - <property name="top_attach">5</property> + <property name="top_attach">7</property> <property name="width">3</property> </packing> </child> @@ -1574,6 +1580,7 @@ Author: Antenore Gatta <property name="can_focus">False</property> <property name="halign">start</property> <property name="margin_left">36</property> + <property name="margin_start">36</property> <property name="label" translatable="yes">Password</property> </object> <packing> @@ -1587,6 +1594,7 @@ Author: Antenore Gatta <property name="can_focus">False</property> <property name="halign">start</property> <property name="margin_left">36</property> + <property name="margin_start">36</property> <property name="label" translatable="yes">Repeat the password</property> </object> <packing> @@ -1599,7 +1607,7 @@ Author: Antenore Gatta <property name="visible">True</property> <property name="can_focus">True</property> <property name="halign">start</property> - <property name="margin_right">18</property> + <property name="margin_end">18</property> <property name="hexpand">True</property> <property name="visibility">False</property> <property name="invisible_char">•</property> @@ -1617,7 +1625,7 @@ Author: Antenore Gatta <property name="visible">True</property> <property name="can_focus">True</property> <property name="halign">start</property> - <property name="margin_right">18</property> + <property name="margin_end">18</property> <property name="hexpand">True</property> <property name="visibility">False</property> <property name="invisible_char">•</property> @@ -1634,6 +1642,59 @@ Author: Antenore Gatta <property name="width">2</property> </packing> </child> + <child> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">start</property> + <property name="margin_start">18</property> + <property name="margin_top">9</property> + <property name="hexpand">False</property> + <property name="label" translatable="yes">Fingerprinters and certificates</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">5</property> + <property name="width">3</property> + </packing> + </child> + <child> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="tooltip_text" translatable="yes">Automatically accept all fingerprinters and certificates</property> + <property name="halign">start</property> + <property name="margin_start">36</property> + <property name="margin_top">9</property> + <property name="margin_bottom">9</property> + <property name="hexpand">True</property> + <property name="label" translatable="yes">Trust all fingerprinters and certificates</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">6</property> + </packing> + </child> + <child> + <object class="GtkSwitch" id="switch_security_trust_all"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Use secret key authentication for some widgets</property> + <property name="halign">start</property> + <property name="margin_end">18</property> + <property name="margin_top">9</property> + <property name="margin_bottom">9</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">6</property> + <property name="width">2</property> + </packing> + </child> </object> <packing> <property name="position">5</property> @@ -1646,6 +1707,7 @@ Author: Antenore Gatta <property name="label" translatable="yes">Security</property> </object> <packing> + <property name="menu_label">security</property> <property name="position">5</property> <property name="tab_fill">False</property> </packing> @@ -2421,6 +2483,7 @@ Author: Antenore Gatta <property name="label" translatable="yes">Terminal</property> </object> <packing> + <property name="menu_label">terminal</property> <property name="position">6</property> <property name="tab_fill">False</property> </packing> @@ -2434,5 +2497,8 @@ Author: Antenore Gatta </child> </object> </child> + <child type="titlebar"> + <placeholder/> + </child> </object> </interface> diff --git a/src/remmina_main.c b/src/remmina_main.c index fef677fc7..ed692e4b7 100644 --- a/src/remmina_main.c +++ b/src/remmina_main.c @@ -88,25 +88,28 @@ const gchar *supported_mime_types[] = { NULL }; -static GActionEntry main_actions[] = { +static GActionEntry app_actions[] = { { "about", remmina_main_on_action_application_about, NULL, NULL, NULL }, { "news", remmina_main_on_action_application_news, NULL, NULL, NULL }, { "default", remmina_main_on_action_application_default, NULL, NULL, NULL }, { "mpchange", remmina_main_on_action_application_mpchange, NULL, NULL, NULL }, { "plugins", remmina_main_on_action_application_plugins, NULL, NULL, NULL }, - { "preferences", remmina_main_on_action_application_preferences, NULL, NULL, NULL }, + { "preferences", remmina_main_on_action_application_preferences, "i", NULL, NULL }, { "quit", remmina_main_on_action_application_quit, NULL, NULL, NULL }, + { "debug", remmina_main_on_action_help_debug, NULL, NULL, NULL }, + { "community", remmina_main_on_action_help_community, NULL, NULL, NULL }, + { "donations", remmina_main_on_action_help_donations, NULL, NULL, NULL }, + { "homepage", remmina_main_on_action_help_homepage, NULL, NULL, NULL }, + { "wiki", remmina_main_on_action_help_wiki, NULL, NULL, NULL }, +}; + +static GActionEntry main_actions[] = { { "connect", remmina_main_on_action_connection_connect, NULL, NULL, NULL }, { "copy", remmina_main_on_action_connection_copy, NULL, NULL, NULL }, { "delete", remmina_main_on_action_connection_delete, NULL, NULL, NULL }, { "edit", remmina_main_on_action_connection_edit, NULL, NULL, NULL }, { "exttools", remmina_main_on_action_connection_external_tools, NULL, NULL, NULL }, { "new", remmina_main_on_action_connection_new, NULL, NULL, NULL }, - { "community", remmina_main_on_action_help_community, NULL, NULL, NULL }, - { "debug", remmina_main_on_action_help_debug, NULL, NULL, NULL }, - { "donations", remmina_main_on_action_help_donations, NULL, NULL, NULL }, - { "homepage", remmina_main_on_action_help_homepage, NULL, NULL, NULL }, - { "wiki", remmina_main_on_action_help_wiki, NULL, NULL, NULL }, { "export", remmina_main_on_action_tools_export, NULL, NULL, NULL }, { "import", remmina_main_on_action_tools_import, NULL, NULL, NULL }, { "expand", remmina_main_on_action_expand, NULL, NULL, NULL }, @@ -847,9 +850,19 @@ void remmina_main_on_action_connection_delete(GSimpleAction *action, GVariant *p void remmina_main_on_action_application_preferences(GSimpleAction *action, GVariant *param, gpointer data) { TRACE_CALL(__func__); + + REMMINA_DEBUG ("Opening the preferences"); + gint32 tab_num; + if (param) { + REMMINA_DEBUG ("Parameter passed to preferences of type %s", g_variant_get_type_string(param)); + tab_num = g_variant_get_int32 (param); + REMMINA_DEBUG ("We got a parameter for the preferences: %d", tab_num); + } else + tab_num = 0; + if (remmina_unlock_new(remminamain->window) == 0) return; - GtkDialog *dialog = remmina_pref_dialog_new(0, remminamain->window); + GtkDialog *dialog = remmina_pref_dialog_new(tab_num, remminamain->window); gtk_dialog_run(dialog); gtk_widget_destroy(GTK_WIDGET(dialog)); } @@ -1362,6 +1375,8 @@ GtkWidget *remmina_main_new(void) remminamain->statusbar_main = GTK_STATUSBAR(RM_GET_OBJECT("statusbar_main")); /* Non widget objects */ actions = g_simple_action_group_new(); + g_action_map_add_action_entries(G_ACTION_MAP(actions), app_actions, G_N_ELEMENTS(app_actions), remminamain->window); + gtk_widget_insert_action_group(GTK_WIDGET(remminamain->window), "app", G_ACTION_GROUP(actions)); g_action_map_add_action_entries(G_ACTION_MAP(actions), main_actions, G_N_ELEMENTS(main_actions), remminamain->window); gtk_widget_insert_action_group(GTK_WIDGET(remminamain->window), "main", G_ACTION_GROUP(actions)); g_object_unref(actions); diff --git a/src/remmina_pref.c b/src/remmina_pref.c index 080b04c31..5ca685c5b 100644 --- a/src/remmina_pref.c +++ b/src/remmina_pref.c @@ -296,6 +296,10 @@ void remmina_pref_init(void) else remmina_pref.unlock_password = g_strdup(""); + if (g_key_file_has_key(gkeyfile, "remmina_pref", "trust_all", NULL)) + remmina_pref.trust_all = g_key_file_get_boolean(gkeyfile, "remmina_pref", "trust_all", NULL); + else + remmina_pref.trust_all = FALSE; if (g_key_file_has_key(gkeyfile, "remmina_pref", "fullscreen_on_auto", NULL)) remmina_pref.fullscreen_on_auto = g_key_file_get_boolean(gkeyfile, "remmina_pref", "fullscreen_on_auto", NULL); @@ -762,6 +766,7 @@ gboolean remmina_pref_save(void) g_key_file_set_integer(gkeyfile, "remmina_pref", "unlock_timeout", 0); g_key_file_set_string(gkeyfile, "remmina_pref", "unlock_password", g_strdup("")); #endif + g_key_file_set_boolean(gkeyfile, "remmina_pref", "trust_all", remmina_pref.trust_all); g_key_file_set_integer(gkeyfile, "remmina_pref", "floating_toolbar_placement", remmina_pref.floating_toolbar_placement); g_key_file_set_integer(gkeyfile, "remmina_pref", "toolbar_placement", remmina_pref.toolbar_placement); g_key_file_set_boolean(gkeyfile, "remmina_pref", "prevent_snap_welcome_message", remmina_pref.prevent_snap_welcome_message); diff --git a/src/remmina_pref.h b/src/remmina_pref.h index e13f2db81..fbc0cf523 100644 --- a/src/remmina_pref.h +++ b/src/remmina_pref.h @@ -116,10 +116,6 @@ typedef struct _RemminaPref { gboolean deny_screenshot_clipboard; const gchar * screenshot_name; gboolean save_view_mode; - gboolean use_master_password; - const gchar * unlock_password; - const gchar * unlock_repassword; - gint unlock_timeout; gint default_action; gint scale_quality; gint auto_scroll_step; @@ -161,6 +157,12 @@ typedef struct _RemminaPref { guint shortcutkey_minimize; guint shortcutkey_disconnect; guint shortcutkey_toolbar; + /* In RemminaPrefDialog security tab */ + gboolean use_master_password; + const gchar * unlock_password; + const gchar * unlock_repassword; + gint unlock_timeout; + gboolean trust_all; /* In RemminaPrefDialog terminal tab */ gchar * vte_font; gboolean vte_allow_bold_text; diff --git a/src/remmina_pref_dialog.c b/src/remmina_pref_dialog.c index d08864477..f102a873b 100644 --- a/src/remmina_pref_dialog.c +++ b/src/remmina_pref_dialog.c @@ -212,6 +212,7 @@ void remmina_pref_on_dialog_destroy(GtkWidget *widget, gpointer user_data) if (gtk_entry_get_text_length(remmina_pref_dialog->unlock_repassword) != 0) remmina_pref.unlock_password = remmina_sodium_pwhash_str(gtk_entry_get_text(remmina_pref_dialog->unlock_password)); #endif + remmina_pref.trust_all = gtk_switch_get_active(GTK_SWITCH(remmina_pref_dialog->switch_security_trust_all)); remmina_pref.screenshot_path = gtk_file_chooser_get_filename(remmina_pref_dialog->filechooserbutton_options_screenshots_path); remmina_pref.fullscreen_on_auto = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_appearance_fullscreen_on_auto)); remmina_pref.always_show_tab = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_appearance_show_tabs)); @@ -450,6 +451,7 @@ static void remmina_pref_dialog_init(void) gtk_widget_set_sensitive(GTK_WIDGET(remmina_pref_dialog->unlock_repassword), FALSE); gtk_widget_set_sensitive(GTK_WIDGET(remmina_pref_dialog->unlock_timeout), FALSE); #endif + gtk_switch_set_active(GTK_SWITCH(remmina_pref_dialog->switch_security_trust_all), remmina_pref.trust_all); gtk_switch_set_active(GTK_SWITCH(remmina_pref_dialog->switch_options_deny_screenshot_clipboard), remmina_pref.deny_screenshot_clipboard); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_appearance_fullscreen_on_auto), remmina_pref.fullscreen_on_auto); @@ -642,6 +644,7 @@ GtkDialog* remmina_pref_dialog_new(gint default_tab, GtkWindow *parent) remmina_pref_dialog->switch_security_use_master_password = GTK_SWITCH(GET_OBJECT("switch_security_use_master_password")); remmina_pref_dialog->unlock_password = GTK_ENTRY(GET_OBJECT("unlock_password")); remmina_pref_dialog->unlock_repassword = GTK_ENTRY(GET_OBJECT("unlock_repassword")); + remmina_pref_dialog->switch_security_trust_all = GTK_SWITCH(GET_OBJECT("switch_security_trust_all")); remmina_pref_dialog->checkbutton_options_save_settings = GTK_CHECK_BUTTON(GET_OBJECT("checkbutton_options_save_settings")); remmina_pref_dialog->checkbutton_appearance_fullscreen_on_auto = GTK_CHECK_BUTTON(GET_OBJECT("checkbutton_appearance_fullscreen_on_auto")); remmina_pref_dialog->checkbutton_appearance_show_tabs = GTK_CHECK_BUTTON(GET_OBJECT("checkbutton_appearance_show_tabs")); diff --git a/src/remmina_pref_dialog.h b/src/remmina_pref_dialog.h index 2fc2a3cd8..b9ef7e36d 100644 --- a/src/remmina_pref_dialog.h +++ b/src/remmina_pref_dialog.h @@ -58,6 +58,7 @@ typedef struct _RemminaPrefDialog { GtkEntry * unlock_timeout; GtkEntry * unlock_password; GtkEntry * unlock_repassword; + GtkSwitch * switch_security_trust_all; GtkCheckButton * checkbutton_options_save_settings; GtkCheckButton * checkbutton_appearance_fullscreen_on_auto; GtkCheckButton * checkbutton_appearance_show_tabs; diff --git a/src/remmina_protocol_widget.c b/src/remmina_protocol_widget.c index ac3724d02..d595df1fb 100644 --- a/src/remmina_protocol_widget.c +++ b/src/remmina_protocol_widget.c @@ -1494,6 +1494,12 @@ gint remmina_protocol_widget_panel_new_certificate(RemminaProtocolWidget *gp, co gchar *s; int rc; + if (remmina_pref_get_boolean("trust_all")) { + /* For compatibility with plugin API: The plugin expects GTK_RESPONSE_OK when user confirms new cert */ + remmina_public_send_notification("remmina-security-trust-all-id", _("Fingerprint automatically accepted"), fingerprint); + rc = GTK_RESPONSE_OK; + return rc; + } // For markup see https://developer.gnome.org/pygtk/stable/pango-markup-language.html s = g_strdup_printf( "<big>%s</big>\n\n%s %s\n%s %s\n%s %s\n\n<big>%s</big>", @@ -1515,6 +1521,12 @@ gint remmina_protocol_widget_panel_changed_certificate(RemminaProtocolWidget *gp gchar *s; int rc; + if (remmina_pref_get_boolean("trust_all")) { + /* For compatibility with plugin API: The plugin expects GTK_RESPONSE_OK when user confirms new cert */ + remmina_public_send_notification("remmina-security-trust-all-id", _("Fingerprint automatically accepted"), new_fingerprint); + rc = GTK_RESPONSE_OK; + return rc; + } // For markup see https://developer.gnome.org/pygtk/stable/pango-markup-language.html s = g_strdup_printf( "<big>%s</big>\n\n%s %s\n%s %s\n%s %s\n%s %s\n\n<big>%s</big>", diff --git a/src/remmina_public.c b/src/remmina_public.c index 3e17450a9..cd55d5c57 100644 --- a/src/remmina_public.c +++ b/src/remmina_public.c @@ -646,13 +646,24 @@ void remmina_public_send_notification(const gchar *notification_id, { TRACE_CALL(__func__); - GNotification *notification = g_notification_new(notification_title); - g_notification_set_body(notification, notification_message); + g_autoptr(GNotification) n = NULL; + gint priority = G_NOTIFICATION_PRIORITY_NORMAL; + + n = g_notification_new(notification_title); + g_notification_set_body(n, notification_message); + if (g_strcmp0 (notification_id, "remmina-security-trust-all-id") == 0) { + g_debug ("remmina_public_send_notification: We got a remmina-security-trust-all-id notification"); + priority = G_NOTIFICATION_PRIORITY_HIGH; + /** parameter 5 is the tab index for the security tab in the preferences + * TODO: Do not hardcode the parameter + * TODO: Do not hardcode implement DBus interface correctly of this won't work*/ + g_notification_set_default_action_and_target (n, "app.preferences", "i", 5); + g_notification_add_button_with_target (n, _("Change security settings"), "app.preferences", "i", 5); + } #if GLIB_CHECK_VERSION(2, 42, 0) - g_notification_set_priority(notification, G_NOTIFICATION_PRIORITY_NORMAL); + g_notification_set_priority(n, priority); #endif - g_application_send_notification(g_application_get_default(), notification_id, notification); - g_object_unref(notification); + g_application_send_notification(g_application_get_default(), notification_id, n); } /* Replaces all occurrences of search in a new copy of string by replacement. */ |