diff options
author | Antenore Gatta <antenore@simbiosi.org> | 2021-02-05 18:20:48 +0300 |
---|---|---|
committer | Antenore Gatta <antenore@simbiosi.org> | 2021-02-05 18:20:48 +0300 |
commit | a4f4e7eb0ab850bf01a93cef65b0502ddc490c6e (patch) | |
tree | a3dbdab93aff817899f274a34599c6d05d0fcdfd /src | |
parent | 4f8e242e1461916861224e891e245d1803b7b759 (diff) |
Implement fullscreen toolbar colors as per #1894
Diffstat (limited to 'src')
-rw-r--r-- | src/rcw.c | 17 | ||||
-rw-r--r-- | src/remmina_pref.c | 6 | ||||
-rw-r--r-- | src/remmina_pref.h | 3 | ||||
-rw-r--r-- | src/remmina_pref_dialog.c | 13 | ||||
-rw-r--r-- | src/remmina_pref_dialog.h | 1 |
5 files changed, 35 insertions, 5 deletions
@@ -2503,12 +2503,27 @@ static void rco_update_toolbar(RemminaConnectionObject *cnnobj) if (test_floating_toolbar) { const gchar *str = remmina_file_get_string(cnnobj->remmina_file, "name"); - const gchar *format = "<big><b>\%s</b></big>"; + const gchar *format; + GdkRGBA rgba; + gchar *bg; + + bg = g_strdup(remmina_pref.grab_color); + if (!gdk_rgba_parse(&rgba, bg)) { + REMMINA_DEBUG ("%s cannot be parsed as a color", bg); + bg = g_strdup("#00FF00"); + } else + REMMINA_DEBUG ("Using %s as background color", bg); + + if (remmina_file_get_int(cnnobj->remmina_file, "keyboard_grab", FALSE)) + format = g_strconcat("<span bgcolor=\"", bg, "\" size=\"large\"><b>(G:ON) - \%s</b></span>", NULL); + else + format = "<big><b>(G:OFF) - \%s</b></big>"; gchar *markup; markup = g_markup_printf_escaped (format, str); gtk_label_set_markup (GTK_LABEL (priv->floating_toolbar_label), markup); g_free (markup); + g_free (bg); } priv->toolbar_is_reconfiguring = FALSE; diff --git a/src/remmina_pref.c b/src/remmina_pref.c index addbfe0d2..d5327c319 100644 --- a/src/remmina_pref.c +++ b/src/remmina_pref.c @@ -499,6 +499,11 @@ void remmina_pref_init(void) else remmina_pref.dark_theme = FALSE; + if (g_key_file_has_key(gkeyfile, "remmina_pref", "grab_color", NULL)) + remmina_pref.grab_color = g_key_file_get_string(gkeyfile, "remmina_pref", "grab_color", NULL); + else + remmina_pref.grab_color = "#00ff00"; + if (g_key_file_has_key(gkeyfile, "remmina_pref", "recent_maximum", NULL)) remmina_pref.recent_maximum = g_key_file_get_integer(gkeyfile, "remmina_pref", "recent_maximum", NULL); else @@ -821,6 +826,7 @@ gboolean remmina_pref_save(void) g_key_file_set_integer(gkeyfile, "remmina_pref", "shortcutkey_disconnect", remmina_pref.shortcutkey_disconnect); g_key_file_set_integer(gkeyfile, "remmina_pref", "shortcutkey_toolbar", remmina_pref.shortcutkey_toolbar); g_key_file_set_string(gkeyfile, "remmina_pref", "vte_font", remmina_pref.vte_font ? remmina_pref.vte_font : ""); + g_key_file_set_string(gkeyfile, "remmina_pref", "grab_color", remmina_pref.grab_color ? remmina_pref.grab_color : ""); g_key_file_set_boolean(gkeyfile, "remmina_pref", "vte_allow_bold_text", remmina_pref.vte_allow_bold_text); g_key_file_set_integer(gkeyfile, "remmina_pref", "vte_lines", remmina_pref.vte_lines); g_key_file_set_string(gkeyfile, "ssh_colors", "background", remmina_pref.color_pref.background ? remmina_pref.color_pref.background : ""); diff --git a/src/remmina_pref.h b/src/remmina_pref.h index 389daeda8..c535a9725 100644 --- a/src/remmina_pref.h +++ b/src/remmina_pref.h @@ -125,6 +125,7 @@ typedef struct _RemminaPref { gchar * resolutions; gchar * keystrokes; /* In RemminaPrefDialog appearance tab */ + gboolean dark_theme; gboolean fullscreen_on_auto; gboolean always_show_tab; gboolean hide_connection_toolbar; @@ -132,11 +133,11 @@ typedef struct _RemminaPref { gint default_mode; gint tab_mode; gint fullscreen_toolbar_visibility; + const gchar * grab_color; /* In RemminaPrefDialog applet tab */ gboolean applet_new_ontop; gboolean applet_hide_count; gboolean disable_tray_icon; - gboolean dark_theme; /* In RemminaPrefDialog SSH Option tab */ gint ssh_loglevel; gboolean ssh_parseconfig; diff --git a/src/remmina_pref_dialog.c b/src/remmina_pref_dialog.c index 81f77e6c7..ac129739e 100644 --- a/src/remmina_pref_dialog.c +++ b/src/remmina_pref_dialog.c @@ -283,6 +283,7 @@ void remmina_pref_on_dialog_destroy(GtkWidget *widget, gpointer user_data) remmina_pref.dark_theme = b; rebuild_remmina_icon = TRUE; } + remmina_pref.grab_color = gtk_entry_get_text(remmina_pref_dialog->entry_grab_color); b = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_applet_disable_tray)); if (remmina_pref.disable_tray_icon != b) { @@ -614,11 +615,11 @@ static void remmina_pref_dialog_init(void) if (remmina_pref.datadir_path != NULL && strlen(remmina_pref.datadir_path) > 0) { gtk_file_chooser_set_filename(remmina_pref_dialog->filechooserbutton_options_datadir_path, remmina_pref.datadir_path); } - if (remmina_pref.remmina_file_name != NULL) { + if (remmina_pref.remmina_file_name != NULL) gtk_entry_set_text(remmina_pref_dialog->entry_options_file_name, remmina_pref.remmina_file_name); - }else{ + else gtk_entry_set_text(remmina_pref_dialog->entry_options_file_name, "%G_%P_%N_%h.remmina"); - } + if (remmina_pref.screenshot_path != NULL) { gtk_file_chooser_set_filename(remmina_pref_dialog->filechooserbutton_options_screenshots_path, remmina_pref.screenshot_path); }else{ @@ -629,6 +630,11 @@ static void remmina_pref_dialog_init(void) }else{ gtk_entry_set_text(remmina_pref_dialog->entry_options_screenshot_name, "remmina_%p_%h_%Y%m%d-%H%M%S"); } + if (remmina_pref.grab_color != NULL) + gtk_entry_set_text(remmina_pref_dialog->entry_grab_color, remmina_pref.grab_color); + else + gtk_entry_set_text(remmina_pref_dialog->entry_options_file_name, "#00FF00"); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_options_ssh_parseconfig), remmina_pref.ssh_parseconfig); remmina_pref_dialog_set_button_label(remmina_pref_dialog->button_keyboard_copy, remmina_pref.vte_shortcutkey_copy); @@ -693,6 +699,7 @@ GtkDialog* remmina_pref_dialog_new(gint default_tab, GtkWindow *parent) remmina_pref_dialog->entry_options_ssh_tcp_usrtimeout = GTK_ENTRY(GET_OBJECT("entry_options_ssh_tcp_usrtimeout")); remmina_pref_dialog->entry_options_scroll = GTK_ENTRY(GET_OBJECT("entry_options_scroll")); remmina_pref_dialog->entry_options_recent_items = GTK_ENTRY(GET_OBJECT("entry_options_recent_items")); + remmina_pref_dialog->entry_grab_color = GTK_ENTRY(GET_OBJECT("entry_grab_color")); remmina_pref_dialog->button_options_recent_items_clear = GTK_BUTTON(GET_OBJECT("button_options_recent_items_clear")); remmina_pref_dialog->unlock_timeout = GTK_ENTRY(GET_OBJECT("unlock_timeout")); diff --git a/src/remmina_pref_dialog.h b/src/remmina_pref_dialog.h index 04838fad3..0aa28e246 100644 --- a/src/remmina_pref_dialog.h +++ b/src/remmina_pref_dialog.h @@ -81,6 +81,7 @@ typedef struct _RemminaPrefDialog { GtkEntry * entry_options_ssh_tcp_usrtimeout; GtkEntry * entry_options_scroll; GtkEntry * entry_options_recent_items; + GtkEntry * entry_grab_color; GtkButton * button_options_recent_items_clear; GtkButton * button_options_resolutions; |