Updating branch refs/heads/master to 1cb91001d3ee1e45793a1ad3f0e0db631597440d (commit) from a37874da585ba11fc4e1ed09181ca60944510313 (commit)
commit 1cb91001d3ee1e45793a1ad3f0e0db631597440d Author: Nick Schermer <n...@xfce.org> Date: Tue Dec 25 13:24:27 2012 +0100 Allow setting the bold color (bug #5987). terminal/terminal-preferences-dialog.c | 23 ++++--- terminal/terminal-preferences.c | 22 +++++++ terminal/terminal-preferences.glade | 105 +++++++++++++++++++------------- terminal/terminal-screen.c | 26 ++++++-- 4 files changed, 118 insertions(+), 58 deletions(-) diff --git a/terminal/terminal-preferences-dialog.c b/terminal/terminal-preferences-dialog.c index 88d52e5..8a14aab 100644 --- a/terminal/terminal-preferences-dialog.c +++ b/terminal/terminal-preferences-dialog.c @@ -127,7 +127,7 @@ terminal_preferences_dialog_init (TerminalPreferencesDialog *dialog) "scrolling-on-output", "scrolling-on-keystroke", "scrolling-bar", "font-allow-bold", "misc-menubar-default", "misc-toolbars-default", - "misc-borders-default", "color-selection-use-default", + "misc-borders-default", "shortcuts-no-mnemonics", "shortcuts-no-menukey", "binding-backspace", "binding-delete", "background-mode", "background-image-style", @@ -135,7 +135,7 @@ terminal_preferences_dialog_init (TerminalPreferencesDialog *dialog) }; const gchar *props_color[] = { "color-foreground", "color-cursor", "color-background", "tab-activity-color", - "color-selection" + "color-selection", "color-bold" }; dialog->preferences = terminal_preferences_get (); @@ -218,18 +218,23 @@ error: g_signal_connect (G_OBJECT (object), "clicked", G_CALLBACK (terminal_preferences_dialog_reset_word_chars), dialog); - /* inverted action between cursor color selections */ - object = gtk_builder_get_object (GTK_BUILDER (dialog), "color-selection-use-color"); + /* inverted custom colors and set sensitivity */ + object = gtk_builder_get_object (GTK_BUILDER (dialog), "color-selection-custom"); terminal_return_if_fail (G_IS_OBJECT (object)); g_object_bind_property (G_OBJECT (dialog->preferences), "color-selection-use-default", G_OBJECT (object), "active", - G_BINDING_INVERT_BOOLEAN | G_BINDING_SYNC_CREATE); + G_BINDING_INVERT_BOOLEAN | G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); + object2 = gtk_builder_get_object (GTK_BUILDER (dialog), "color-selection"); + g_object_bind_property (G_OBJECT (object), "active", + G_OBJECT (object2), "sensitive", + G_BINDING_SYNC_CREATE); - /* sensitivity for custom selection color */ - object = gtk_builder_get_object (GTK_BUILDER (dialog), "color-selection-use-color"); + object = gtk_builder_get_object (GTK_BUILDER (dialog), "color-bold-custom"); terminal_return_if_fail (G_IS_OBJECT (object)); - object2 = gtk_builder_get_object (GTK_BUILDER (dialog), "color-selection"); - terminal_return_if_fail (G_IS_OBJECT (object2)); + g_object_bind_property (G_OBJECT (dialog->preferences), "color-bold-use-default", + G_OBJECT (object), "active", + G_BINDING_INVERT_BOOLEAN | G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); + object2 = gtk_builder_get_object (GTK_BUILDER (dialog), "color-bold"); g_object_bind_property (G_OBJECT (object), "active", G_OBJECT (object2), "sensitive", G_BINDING_SYNC_CREATE); diff --git a/terminal/terminal-preferences.c b/terminal/terminal-preferences.c index 522f7cd..5010f25 100644 --- a/terminal/terminal-preferences.c +++ b/terminal/terminal-preferences.c @@ -56,6 +56,8 @@ enum PROP_COLOR_CURSOR, PROP_COLOR_SELECTION, PROP_COLOR_SELECTION_USE_DEFAULT, + PROP_COLOR_BOLD, + PROP_COLOR_BOLD_USE_DEFAULT, PROP_COLOR_PALETTE, PROP_COMMAND_UPDATE_RECORDS, PROP_COMMAND_LOGIN_SHELL, @@ -393,6 +395,26 @@ terminal_preferences_class_init (TerminalPreferencesClass *klass) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); /** + * TerminalPreferences:color-bold: + **/ + preferences_props[PROP_COLOR_BOLD] = + g_param_spec_string ("color-bold", + "color-bold", + "ColorBold", + "#ffffff", + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + + /** + * TerminalPreferences:color-bold-use-default: + **/ + preferences_props[PROP_COLOR_BOLD_USE_DEFAULT] = + g_param_spec_boolean ("color-bold-use-default", + "color-bold-use-default", + "ColorBoldUseDefault", + TRUE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + + /** * TerminalPreferences:color-palette: **/ preferences_props[PROP_COLOR_PALETTE] = diff --git a/terminal/terminal-preferences.glade b/terminal/terminal-preferences.glade index b8c1fb2..0b78d85 100644 --- a/terminal/terminal-preferences.glade +++ b/terminal/terminal-preferences.glade @@ -1134,7 +1134,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> - <property name="title" translatable="yes">Choose terminal background color</property> + <property name="title" translatable="yes">Choose background color</property> <property name="color">#000000000000</property> <child internal-child="accessible"> <object class="AtkObject" id="color-background-atkobject"> @@ -1164,7 +1164,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> - <property name="title" translatable="yes">Choose terminal text color</property> + <property name="title" translatable="yes">Choose text color</property> <property name="color">#000000000000</property> <child internal-child="accessible"> <object class="AtkObject" id="color-foreground-atkobject"> @@ -1192,7 +1192,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> - <property name="title" translatable="yes">Choose terminal cursor color</property> + <property name="title" translatable="yes">Choose cursor color</property> <property name="color">#000000000000</property> <child internal-child="accessible"> <object class="AtkObject" id="color-cursor-atkobject"> @@ -1272,59 +1272,42 @@ <property name="can_focus">False</property> <property name="left_padding">12</property> <child> - <object class="GtkVBox" id="vbox9"> + <object class="GtkTable" id="table6"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="border_width">6</property> - <property name="spacing">6</property> + <property name="n_rows">2</property> + <property name="n_columns">2</property> + <property name="column_spacing">12</property> + <property name="row_spacing">6</property> <child> - <object class="GtkRadioButton" id="color-selection-use-default"> - <property name="label" translatable="yes">Use _default color</property> + <object class="GtkCheckButton" id="color-selection-custom"> + <property name="label" translatable="yes">Text _selection color:</property> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Use the default text selection background color</property> + <property name="tooltip_text" translatable="yes">Enable this option to set a custom background color for the selection. If disabled the background and text colors will be reversed.</property> <property name="use_underline">True</property> - <property name="active">True</property> <property name="draw_indicator">True</property> </object> <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">0</property> + <property name="x_options">GTK_FILL</property> </packing> </child> <child> - <object class="GtkHBox" id="hbox3"> + <object class="GtkAlignment" id="alignment22"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="spacing">12</property> - <child> - <object class="GtkRadioButton" id="color-selection-use-color"> - <property name="label" translatable="yes">Use c_ustom color:</property> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Use a custom text selection background color</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> - <property name="group">color-selection-use-default</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> + <property name="xalign">0</property> + <property name="xscale">0</property> <child> <object class="GtkColorButton" id="color-selection"> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> - <property name="title" translatable="yes">Choose terminal text selection background color</property> + <property name="title" translatable="yes">Choose text selection background color</property> <property name="color">#000000000000</property> <child internal-child="accessible"> <object class="AtkObject" id="color-selection-atkobject"> @@ -1333,17 +1316,52 @@ </object> </child> </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> </child> </object> <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="color-bold-custom"> + <property name="label" translatable="yes">B_old text color:</property> + <property name="use_action_appearance">False</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Enable this option to set a custom bold color. If disabled the text color will be used.</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">GTK_FILL</property> + </packing> + </child> + <child> + <object class="GtkAlignment" id="alignment23"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="xscale">0</property> + <child> + <object class="GtkColorButton" id="color-bold"> + <property name="use_action_appearance">False</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="title" translatable="yes">Choose bold font color</property> + <property name="color">#000000000000</property> + </object> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> </packing> </child> </object> @@ -1354,7 +1372,7 @@ <object class="GtkLabel" id="label18"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">Text Selection</property> + <property name="label" translatable="yes">Custom Colors</property> <property name="use_markup">True</property> <attributes> <attribute name="weight" value="bold"/> @@ -1390,7 +1408,8 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="xalign">0</property> - <property name="label" translatable="yes">Terminal applications have this color palette available to them:</property> + <property name="label" translatable="yes">Terminal applications have this color palette available to them.</property> + <property name="use_markup">True</property> </object> <packing> <property name="expand">True</property> diff --git a/terminal/terminal-screen.c b/terminal/terminal-screen.c index b3178fc..3e4b8cf 100644 --- a/terminal/terminal-screen.c +++ b/terminal/terminal-screen.c @@ -294,6 +294,8 @@ terminal_screen_init (TerminalScreen *screen) "swapped-signal::notify::color-cursor", G_CALLBACK (terminal_screen_update_colors), screen, "swapped-signal::notify::color-selection", G_CALLBACK (terminal_screen_update_colors), screen, "swapped-signal::notify::color-selection-use-default", G_CALLBACK (terminal_screen_update_colors), screen, + "swapped-signal::notify::color-bold", G_CALLBACK (terminal_screen_update_colors), screen, + "swapped-signal::notify::color-bold-use-default", G_CALLBACK (terminal_screen_update_colors), screen, "swapped-signal::notify::color-palette", G_CALLBACK (terminal_screen_update_colors), screen, "swapped-signal::notify::font-allow-bold", G_CALLBACK (terminal_screen_update_font), screen, "swapped-signal::notify::font-name", G_CALLBACK (terminal_screen_update_font), screen, @@ -816,7 +818,9 @@ terminal_screen_update_colors (TerminalScreen *screen) GdkColor fg; GdkColor cursor; GdkColor selection; - gboolean use_default; + GdkColor bold; + gboolean selection_use_default; + gboolean bold_use_default; guint n = 0; gboolean has_bg; gboolean has_fg; @@ -831,7 +835,8 @@ terminal_screen_update_colors (TerminalScreen *screen) g_object_get (screen->preferences, "color-palette", &palette_str, - "color-selection-use-default", &use_default, + "color-selection-use-default", &selection_use_default, + "color-bold-use-default", &bold_use_default, "color-background-vary", &vary_bg, NULL); @@ -854,7 +859,6 @@ terminal_screen_update_colors (TerminalScreen *screen) has_bg = terminal_preferences_get_color (screen->preferences, "color-background", &bg); has_fg = terminal_preferences_get_color (screen->preferences, "color-foreground", &fg); - has_cursor = terminal_preferences_get_color (screen->preferences, "color-cursor", &cursor); /* we pick a random hue value to keep readability */ if (vary_bg && has_bg) @@ -909,11 +913,21 @@ terminal_screen_update_colors (TerminalScreen *screen) } vte_terminal_set_background_tint_color (VTE_TERMINAL (screen->terminal), has_bg ? &bg : NULL); + + /* cursor color */ + has_cursor = terminal_preferences_get_color (screen->preferences, "color-cursor", &cursor); vte_terminal_set_color_cursor (VTE_TERMINAL (screen->terminal), has_cursor ? &cursor : NULL); - if (!use_default) - use_default = !terminal_preferences_get_color (screen->preferences, "color-selection", &selection); - vte_terminal_set_color_highlight (VTE_TERMINAL (screen->terminal), use_default ? NULL : &selection); + /* selection color */ + if (!selection_use_default) + selection_use_default = !terminal_preferences_get_color (screen->preferences, "color-selection", &selection); + vte_terminal_set_color_highlight (VTE_TERMINAL (screen->terminal), selection_use_default ? NULL : &selection); + + /* bold color */ + if (!bold_use_default) + bold_use_default = !terminal_preferences_get_color (screen->preferences, "color-bold", &bold); + if (!bold_use_default || has_fg) + vte_terminal_set_color_bold (VTE_TERMINAL (screen->terminal), bold_use_default ? &fg : &bold); } _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits