diff options
author | Antenore Gatta (tmow) <antenore@simbiosi.org> | 2022-03-25 14:31:30 +0300 |
---|---|---|
committer | Antenore Gatta (tmow) <antenore@simbiosi.org> | 2022-03-25 14:31:30 +0300 |
commit | 6d4a68688e7f59557bfda16fe1210b949e5c256d (patch) | |
tree | 6171f799c26aaf259eeb1351e2a15185f3a93e37 | |
parent | 030df1eb1db4a9c2bf5f26a91ecc48ca95d58541 (diff) | |
parent | 58c788da35a4a363c8d6fbbbbce7249d8d25cc5f (diff) |
Merge branch 'master' into 'master'
Using Remmina from command-line for kiosked servers
See merge request Remmina/Remmina!2392
-rw-r--r-- | src/rcw.c | 25 | ||||
-rw-r--r-- | src/remmina.1 | 8 | ||||
-rw-r--r-- | src/remmina.c | 28 | ||||
-rw-r--r-- | src/remmina_pref.c | 18 | ||||
-rw-r--r-- | src/remmina_pref.h | 3 | ||||
-rw-r--r-- | src/rmnews.c | 2 | ||||
-rw-r--r-- | src/rmnews.h | 1 |
7 files changed, 72 insertions, 13 deletions
@@ -4051,7 +4051,7 @@ static gboolean rcw_hostkey_func(RemminaProtocolWidget *gp, guint keyval, gboole } } - if (keyval == remmina_pref.shortcutkey_fullscreen) { + if (keyval == remmina_pref.shortcutkey_fullscreen && !extrahardening) { switch (priv->view_mode) { case SCROLLED_WINDOW_MODE: rcw_switch_viewmode(cnnobj->cnnwin, priv->fss_view_mode); @@ -4063,20 +4063,20 @@ static gboolean rcw_hostkey_func(RemminaProtocolWidget *gp, guint keyval, gboole default: break; } - } else if (keyval == remmina_pref.shortcutkey_autofit) { + } else if (keyval == remmina_pref.shortcutkey_autofit && !extrahardening) { if (priv->toolitem_autofit && gtk_widget_is_sensitive(GTK_WIDGET(priv->toolitem_autofit))) rcw_toolbar_autofit(GTK_TOOL_ITEM(gp), cnnobj->cnnwin); - } else if (keyval == remmina_pref.shortcutkey_nexttab) { + } else if (keyval == remmina_pref.shortcutkey_nexttab && !extrahardening) { i = gtk_notebook_get_current_page(GTK_NOTEBOOK(priv->notebook)) + 1; if (i >= gtk_notebook_get_n_pages(GTK_NOTEBOOK(priv->notebook))) i = 0; gtk_notebook_set_current_page(GTK_NOTEBOOK(priv->notebook), i); - } else if (keyval == remmina_pref.shortcutkey_prevtab) { + } else if (keyval == remmina_pref.shortcutkey_prevtab && !extrahardening) { i = gtk_notebook_get_current_page(GTK_NOTEBOOK(priv->notebook)) - 1; if (i < 0) i = gtk_notebook_get_n_pages(GTK_NOTEBOOK(priv->notebook)) - 1; gtk_notebook_set_current_page(GTK_NOTEBOOK(priv->notebook), i); - } else if (keyval == remmina_pref.shortcutkey_scale) { + } else if (keyval == remmina_pref.shortcutkey_scale && !extrahardening) { if (gtk_widget_is_sensitive(GTK_WIDGET(priv->toolitem_scale))) { gtk_toggle_tool_button_set_active( GTK_TOGGLE_TOOL_BUTTON(priv->toolitem_scale), @@ -4084,25 +4084,25 @@ static gboolean rcw_hostkey_func(RemminaProtocolWidget *gp, guint keyval, gboole GTK_TOGGLE_TOOL_BUTTON( priv->toolitem_scale))); } - } else if (keyval == remmina_pref.shortcutkey_grab) { + } else if (keyval == remmina_pref.shortcutkey_grab && !extrahardening) { gtk_toggle_tool_button_set_active( GTK_TOGGLE_TOOL_BUTTON(priv->toolitem_grab), !gtk_toggle_tool_button_get_active( GTK_TOGGLE_TOOL_BUTTON( priv->toolitem_grab))); - } else if (keyval == remmina_pref.shortcutkey_minimize) { + } else if (keyval == remmina_pref.shortcutkey_minimize && !extrahardening) { rcw_toolbar_minimize(GTK_TOOL_ITEM(gp), cnnobj->cnnwin); - } else if (keyval == remmina_pref.shortcutkey_viewonly) { + } else if (keyval == remmina_pref.shortcutkey_viewonly && !extrahardening) { remmina_file_set_int(cnnobj->remmina_file, "viewonly", (remmina_file_get_int(cnnobj->remmina_file, "viewonly", 0) == 0) ? 1 : 0); - } else if (keyval == remmina_pref.shortcutkey_screenshot) { + } else if (keyval == remmina_pref.shortcutkey_screenshot && !extrahardening) { rcw_toolbar_screenshot(GTK_TOOL_ITEM(gp), cnnobj->cnnwin); - } else if (keyval == remmina_pref.shortcutkey_disconnect) { + } else if (keyval == remmina_pref.shortcutkey_disconnect && !extrahardening) { rco_disconnect_current_page(cnnobj); - } else if (keyval == remmina_pref.shortcutkey_toolbar) { + } else if (keyval == remmina_pref.shortcutkey_toolbar && !extrahardening) { if (priv->view_mode == SCROLLED_WINDOW_MODE) { remmina_pref.hide_connection_toolbar = !remmina_pref.hide_connection_toolbar; @@ -4458,6 +4458,9 @@ GtkWidget *rcw_open_from_file_full(RemminaFile *remminafile, GCallback disconnec if (ismultimon) view_mode = VIEWPORT_FULLSCREEN_MODE; + if (fullscreen) + view_mode = VIEWPORT_FULLSCREEN_MODE; + /* Create the viewport to make the RemminaProtocolWidget scrollable */ cnnobj->viewport = gtk_viewport_new(NULL, NULL); gtk_widget_set_name(cnnobj->viewport, "remmina-cw-viewport"); diff --git a/src/remmina.1 b/src/remmina.1 index d5b2d3789..9c7fe3904 100644 --- a/src/remmina.1 +++ b/src/remmina.1 @@ -76,6 +76,14 @@ Set one or more profile settings, to be used with \-\-update\-profile Encrypt a password .It --display\fR=\fIDISPLAY\fR X display to use +.It --disable-news\fR +Disable news notification +.It --disable-toolbar\fR +Disable toolbar +.It --enable-fullscreen\fR +Enable fullscreen +.It --enable-extra-hardening\fR +Enable extra hardening (disable closing confirmation, disable unsafe shortcut keys, hide tabs, hide search bar) .El .Sh EXAMPLES .Lp diff --git a/src/remmina.c b/src/remmina.c index 6db94cf32..5013a1356 100644 --- a/src/remmina.c +++ b/src/remmina.c @@ -81,6 +81,10 @@ static int gcrypt_thread_initialized = 0; #endif /* HAVE_LIBGCRYPT */ gboolean kioskmode; +gboolean disablenews; +gboolean disabletoolbar; +gboolean fullscreen; +gboolean extrahardening; static GOptionEntry remmina_options[] = { @@ -121,6 +125,10 @@ static GOptionEntry remmina_options[] = // TRANSLATORS: Shown in terminal. Do not use characters that may be not supported on a terminal { "set-option", 0, 0, G_OPTION_ARG_STRING_ARRAY, NULL, N_("Set one or more profile settings, to be used with --update-profile"), NULL }, { "encrypt-password", 0, 0, G_OPTION_ARG_NONE, NULL, N_("Encrypt a password"), NULL }, + { "disable-news", 0, 0, G_OPTION_ARG_NONE, NULL, N_("Disable news notification"), NULL }, + { "disable-toolbar", 0, 0, G_OPTION_ARG_NONE, NULL, N_("Disable toolbar"), NULL }, + { "enable-fullscreen", 0, 0, G_OPTION_ARG_NONE, NULL, N_("Enable fullscreen"), NULL }, + { "enable-extra-hardening", 0, 0, G_OPTION_ARG_NONE, NULL, N_("Enable extra hardening (disable closing confirmation, disable unsafe shortcut keys, hide tabs, hide search bar)"), NULL }, { NULL } }; @@ -152,10 +160,26 @@ static gint remmina_on_command_line(GApplication *app, GApplicationCommandLine * #if SODIUM_VERSION_INT >= 90200 remmina_sodium_init(); #endif - remmina_pref_init(); - opts = g_application_command_line_get_options_dict(cmdline); + if (g_variant_dict_lookup_value(opts, "disable-news", NULL)) { + disablenews = TRUE; + } + + if (g_variant_dict_lookup_value(opts, "disable-toolbar", NULL)) { + disabletoolbar = TRUE; + } + + if (g_variant_dict_lookup_value(opts, "enable-fullscreen", NULL)) { + fullscreen = TRUE; + } + + if (g_variant_dict_lookup_value(opts, "enable-extra-hardening", NULL)) { + extrahardening = TRUE; + } + + remmina_pref_init(); + if (g_variant_dict_lookup_value(opts, "quit", NULL)) { remmina_exec_command(REMMINA_COMMAND_EXIT, NULL); executed = TRUE; diff --git a/src/remmina_pref.c b/src/remmina_pref.c index 601e0f74a..811a5827b 100644 --- a/src/remmina_pref.c +++ b/src/remmina_pref.c @@ -288,6 +288,9 @@ void remmina_pref_init(void) else remmina_pref.confirm_close = TRUE; + if (extrahardening) + remmina_pref.confirm_close = FALSE; + if (g_key_file_has_key(gkeyfile, "remmina_pref", "use_master_password", NULL)) { remmina_pref.use_primary_password = g_key_file_get_boolean(gkeyfile, "remmina_pref", "use_master_password", NULL); } else if (g_key_file_has_key(gkeyfile, "remmina_pref", "use_primary_password", NULL)) @@ -360,18 +363,27 @@ void remmina_pref_init(void) else remmina_pref.always_show_tab = TRUE; + if (extrahardening) + remmina_pref.always_show_tab = FALSE; + if (g_key_file_has_key(gkeyfile, "remmina_pref", "hide_connection_toolbar", NULL)) remmina_pref.hide_connection_toolbar = g_key_file_get_boolean(gkeyfile, "remmina_pref", "hide_connection_toolbar", NULL); else remmina_pref.hide_connection_toolbar = FALSE; + if (disabletoolbar) + remmina_pref.hide_connection_toolbar = TRUE; + if (g_key_file_has_key(gkeyfile, "remmina_pref", "hide_searchbar", NULL)) remmina_pref.hide_searchbar = g_key_file_get_boolean(gkeyfile, "remmina_pref", "hide_searchbar", NULL); else remmina_pref.hide_searchbar = FALSE; + if (extrahardening) + remmina_pref.hide_searchbar = TRUE; + if (g_key_file_has_key(gkeyfile, "remmina_pref", "default_action", NULL)) remmina_pref.default_action = g_key_file_get_integer(gkeyfile, "remmina_pref", "default_action", NULL); else @@ -557,6 +569,9 @@ void remmina_pref_init(void) else remmina_pref.default_mode = 0; + if (fullscreen) + remmina_pref.default_mode = VIEWPORT_FULLSCREEN_MODE; + if (g_key_file_has_key(gkeyfile, "remmina_pref", "tab_mode", NULL)) remmina_pref.tab_mode = g_key_file_get_integer(gkeyfile, "remmina_pref", "tab_mode", NULL); else @@ -567,6 +582,9 @@ void remmina_pref_init(void) else remmina_pref.fullscreen_toolbar_visibility = FLOATING_TOOLBAR_VISIBILITY_PEEKING; + if (disabletoolbar) + remmina_pref.fullscreen_toolbar_visibility = FLOATING_TOOLBAR_VISIBILITY_DISABLE; + if (g_key_file_has_key(gkeyfile, "remmina_pref", "auto_scroll_step", NULL)) remmina_pref.auto_scroll_step = g_key_file_get_integer(gkeyfile, "remmina_pref", "auto_scroll_step", NULL); else diff --git a/src/remmina_pref.h b/src/remmina_pref.h index 112abf564..c888a8d47 100644 --- a/src/remmina_pref.h +++ b/src/remmina_pref.h @@ -254,6 +254,9 @@ extern const gchar *default_resolutions; extern gchar *remmina_pref_file; extern gchar *remmina_colors_file; extern RemminaPref remmina_pref; +extern gboolean disabletoolbar; +extern gboolean fullscreen; +extern gboolean extrahardening; void remmina_pref_init(void); gboolean remmina_pref_is_rw(void); diff --git a/src/rmnews.c b/src/rmnews.c index a84532eb1..289a55061 100644 --- a/src/rmnews.c +++ b/src/rmnews.c @@ -177,6 +177,8 @@ void rmnews_show_news(GtkWindow *parent) { TRACE_CALL(__func__); + if (disablenews) return; + rmnews_news_dialog = g_new0(RemminaNewsDialog, 1); rmnews_news_dialog->retval = 1; diff --git a/src/rmnews.h b/src/rmnews.h index 32d3dba58..e68bca3ab 100644 --- a/src/rmnews.h +++ b/src/rmnews.h @@ -49,6 +49,7 @@ typedef struct _RemminaNewsDialog { #pragma once G_BEGIN_DECLS +extern gboolean disablenews; void rmnews_schedule(); void rmnews_show_news(); void rmnews_get_url(const char *url); |