diff --git a/dialogs/appearance-settings/appearance-dialog.glade b/dialogs/appearance-settings/appearance-dialog.glade index 2880429..60dba63 100644 --- a/dialogs/appearance-settings/appearance-dialog.glade +++ b/dialogs/appearance-settings/appearance-dialog.glade @@ -1,75 +1,48 @@ - + - - 48 - 1000 - 96 - 1 - 10 - - - - - - - - - None - - - Slight - - - Medium - - - Full - - - - - - - - - - - Icons - - - Text - - - Both - - - Both Horizontal - - - - - - - - - - - + False Appearance center-on-parent preferences-desktop-theme dialog - False Customize the look of your desktop True - vertical + False 2 + + + True + False + end + + + gtk-close + True + True + True + False + True + + + False + False + 0 + + + + + False + True + end + 0 + + True @@ -96,6 +69,7 @@ True + False St_yle True @@ -104,6 +78,275 @@ + + True + False + + + True + False + 8 + 2 + + + True + False + foreground color + right + + + + + True + False + background color + right + + + 1 + 2 + + + + + True + False + text color + right + + + 2 + 3 + + + + + True + False + base color + right + + + 3 + 4 + + + + + True + False + selected foreground color + right + + + 4 + 5 + + + + + True + False + selected background color + right + + + 5 + 6 + + + + + True + False + tooltip foreground color + right + + + 6 + 7 + + + + + True + False + tooltip background color + right + + + 7 + 8 + + + + + True + True + True + False + #000000000000 + + + 1 + 2 + + + + + True + True + True + False + #000000000000 + + + 1 + 2 + 1 + 2 + + + + + True + True + True + False + #000000000000 + + + 1 + 2 + 2 + 3 + + + + + True + True + True + False + #000000000000 + + + 1 + 2 + 3 + 4 + + + + + True + True + True + False + #000000000000 + + + 1 + 2 + 4 + 5 + + + + + True + True + True + False + #000000000000 + + + 1 + 2 + 5 + 6 + + + + + True + True + True + False + #000000000000 + + + 1 + 2 + 6 + 7 + + + + + True + True + True + False + #000000000000 + + + 1 + 2 + 7 + 8 + + + + + True + True + 0 + + + + + True + False + + + reset to defaults + True + True + True + False + + + False + False + 0 + + + + + False + True + 3 + 1 + + + + + 1 + + + + + True + False + Color Scheme + + + 1 + False + + + True True @@ -121,34 +364,37 @@ - 1 + 2 True + False _Icons True - 1 + 2 False True + False 12 - vertical 12 True + False 0 none True + False 6 6 12 @@ -158,6 +404,7 @@ True True This font will be used as the default font used when drawing user interface text + False Select a default font @@ -166,6 +413,7 @@ True + False Default Fon_t True gtk_fontname_button @@ -177,22 +425,26 @@ False + True 0 True + False 0 none True + False 6 12 True + False 6 3 2 @@ -201,6 +453,7 @@ True + False Many fonts contain information that provides extra hints as to how best draw the font; pick whichever looks best according to personal preference liststore1 @@ -220,6 +473,7 @@ True + False Font quality on a TFT or LCD screen can be greatly improved by choosing the correct sub-pixel order of the screen xft_rgba_store @@ -245,6 +499,7 @@ True + False 1 Sub-_pixel order: True @@ -259,6 +514,7 @@ True + False 0 _Hinting: True @@ -277,6 +533,7 @@ True False Anti-aliasing, or font smoothing, can improve the look of text on the screen + False True True True @@ -292,6 +549,7 @@ True + False Rendering @@ -301,22 +559,26 @@ False + True 1 True + False 0 none True + False 6 12 True + False 6 12 @@ -326,11 +588,13 @@ True False Override the detected monitor resolution if fonts look too large or too small + False True True False + True 0 @@ -339,6 +603,10 @@ True False True + False + False + True + True xft_custom_dpi True True @@ -346,6 +614,7 @@ False + True 1 @@ -356,6 +625,7 @@ True + False DPI @@ -365,45 +635,50 @@ False + True 2 - 2 + 3 True + False _Fonts True - 2 + 3 False True + False 12 - vertical 6 True + False 0 none True + False 6 6 12 True + False Specify what should be displayed in toolbar items liststore2 @@ -419,6 +694,7 @@ True + False _Toolbar Style True gtk_toolbar_style_combo_box @@ -430,24 +706,27 @@ False + True 0 True + False 0 none True + False 6 12 True + False 6 - vertical 6 @@ -456,10 +735,13 @@ True False Specify whether icons should be displayed next to text in buttons + False True True + True + True 0 @@ -470,10 +752,13 @@ True False Specify whether icons should be displayed next to items in menus + False True True + True + True 1 @@ -484,10 +769,13 @@ True False If selected, keyboard shortcuts for menu items can be changed by hovering the mouse over the menu item and pressing the new key combination for the shortcut + False True True + True + True 2 @@ -498,6 +786,7 @@ True + False Menus and Buttons @@ -507,23 +796,26 @@ False + True 1 + False 0 none True + False 6 12 True + False 6 - vertical 6 @@ -532,10 +824,13 @@ True False Enable or disable event sounds globally (requires "Canberra" support) + False True True + True + True 0 @@ -546,10 +841,13 @@ True False Specify whether mouse clicks and other user input will cause event sounds to play + False True True + True + True 3 @@ -560,6 +858,7 @@ True + False Event sounds @@ -568,59 +867,99 @@ + True + True 2 - 3 + 4 True + False _Settings True - 3 + 4 False + True + True 1 - - - True - end - - - gtk-close - True - True - True - True - - - False - False - 0 - - - - - False - end - 0 - - button1 + + True + False + gtk-missing-image + + + + + + + + + None + + + Slight + + + Medium + + + Full + + + + + + + + + + + Icons + + + Text + + + Both + + + Both Horizontal + + + + + 48 + 1000 + 96 + 1 + 10 + + + + + + + + + diff --git a/dialogs/appearance-settings/main.c b/dialogs/appearance-settings/main.c index 0f900e1..c8edb6a 100644 --- a/dialogs/appearance-settings/main.c +++ b/dialogs/appearance-settings/main.c @@ -48,6 +48,30 @@ /* Increase this number if new gtk settings have been added */ #define INITIALIZE_UINT (1) + +const guint NUM_COLOR_SCHEME_NAMES = 8; +const gchar *COLOR_SCHEME_NAMES[8] = { + "fg_color", + "bg_color", + "text_color", + "base_color", + "selected_fg_color", + "selected_bg_color", + "tooltip_fg_color", + "tooltip_bg_color" +}; + +const char *COLOR_SCHEME_PROPERTY = "/Gtk/ColorScheme"; +const char *COLOR_SCHEME_DEFAULT_COLORS = "fg_color:#000000\\n" + "bg_color:#EDECEB\\n" + "text_color:#1A1A1A\\n" + "base_color:#ffffff\\n" + "selected_fg_color:#ffffff\\n" + "selected_bg_color:#86ABD9\\n" + "tooltip_fg_color:#000000\\n" + "tooltip_bg_color:#F5F5B5"; + + enum { COLUMN_THEME_NAME, @@ -116,6 +140,7 @@ compute_xsettings_dpi (GtkWidget *widget) return dpi; } + static void cb_theme_tree_selection_changed (GtkTreeSelection *selection, const gchar *property) @@ -267,6 +292,61 @@ cb_enable_event_sounds_check_button_toggled (GtkToggleButton *toggle, GtkWidget } #endif + +static void +cb_unset_color_scheme() +{ + xfconf_channel_set_string(xsettings_channel, COLOR_SCHEME_PROPERTY, ""); +} + + +static GtkWidget *get_color_button(GtkBuilder *builder, const char *color_name) +{ + gchar button_name[100]; + + g_snprintf(button_name, sizeof(button_name), "%s_button", color_name); + + GtkWidget *result = GTK_WIDGET(gtk_builder_get_object(builder, button_name)); + + return result; +} + + + +static void +cb_color_scheme_changed(GtkColorButton *color_button, GtkBuilder *builder) +{ + gchar *color_values[NUM_COLOR_SCHEME_NAMES]; + int i; + + for (i=0; i 0); + + gtk_widget_set_sensitive(button, there_are_colors); + set_color_button_colors(builder, there_are_colors ? color_scheme_str : COLOR_SCHEME_DEFAULT_COLORS); +} + + + static void appearance_settings_load_ui_themes (GtkListStore *list_store, GtkTreeView *tree_view) @@ -668,6 +795,10 @@ appearance_settings_dialog_channel_property_changed (XfconfChannel *channel, appearance_settings_load_icon_themes (GTK_LIST_STORE (model), GTK_TREE_VIEW (object)); } } + else if (strcmp(property_name, COLOR_SCHEME_PROPERTY) == 0) + { + appearance_settings_load_color_scheme(builder); + } } static void @@ -786,6 +917,18 @@ appearance_settings_dialog_configure_widgets (GtkBuilder *builder) g_signal_connect (G_OBJECT (object), "toggled", G_CALLBACK (cb_custom_dpi_check_button_toggled), object2); g_signal_connect (G_OBJECT (object2), "value-changed", G_CALLBACK (cb_custom_dpi_spin_button_changed), object); + /* Color scheme */ + appearance_settings_load_color_scheme(builder); + int i; + for (i=0; ivalue); + value = g_strcompress(g_value_get_string(&entry->value)); if(value) { buf_len += XSETTINGS_PAD(strlen(value), 4); + g_free(value); } } @@ -527,10 +533,11 @@ xsettings_registry_notify(XSettingsRegistry *registry) case G_TYPE_STRING: *pos++ = 1; /* String */ { - value = g_value_get_string(&entry->value); + value = g_strcompress(g_value_get_string(&entry->value)); if(value) { value_len = XSETTINGS_PAD(strlen(value), 4); + g_free(value); } else { @@ -567,7 +574,7 @@ xsettings_registry_notify(XSettingsRegistry *registry) { case G_TYPE_STRING: { - val = g_value_get_string(&entry->value); + val = g_strcompress(g_value_get_string(&entry->value)); if (val) { @@ -577,6 +584,7 @@ xsettings_registry_notify(XSettingsRegistry *registry) memcpy (pos, val, strlen(val)); pos += strlen(val); value_len -= strlen(val); + g_free(val); } else {