diff options
author | linuxCowboy <[email protected]> | 2025-07-01 10:13:34 +0200 |
---|---|---|
committer | Victor Kareh <[email protected]> | 2025-07-05 00:06:15 -0400 |
commit | b01a9f4a5e511f106290161cd52461af455df374 (patch) | |
tree | 0d2fc8df1f9159e482550a43996ad9c5b23c6a2a | |
parent | 38841d397d22deff8c4129aa61d9968d0ac865e8 (diff) | |
download | mate-desktop-master.tar.bz2 mate-desktop-master.tar.xz |
-rw-r--r-- | libmate-desktop/mate-colorsel.c | 22 | ||||
-rw-r--r-- | schemas/org.mate.interface.gschema.xml | 5 |
2 files changed, 26 insertions, 1 deletions
diff --git a/libmate-desktop/mate-colorsel.c b/libmate-desktop/mate-colorsel.c index ca28cda..58f94a6 100644 --- a/libmate-desktop/mate-colorsel.c +++ b/libmate-desktop/mate-colorsel.c @@ -208,7 +208,7 @@ static guint color_selection_signals[LAST_SIGNAL] = { 0 }; static MateColorSelectionChangePaletteFunc noscreen_change_palette_hook = default_noscreen_change_palette_func; static MateColorSelectionChangePaletteWithScreenFunc change_palette_hook = default_change_palette_func; -static gchar color_palette[SIZE_OF_COLOR_PALETTE] = DEFAULT_COLOR_PALETTE; +static gchar color_palette[SIZE_OF_COLOR_PALETTE] = { 0 }; static const guchar dropper_bits[] = { "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" @@ -1151,8 +1151,24 @@ static GdkRGBA * get_current_colors (MateColorSelection *colorsel) { GdkRGBA *colors = NULL; + GSettings *settings; + gchar *str = NULL; gint n_colors = 0; + if (!*color_palette) + { + settings = g_settings_new ("org.mate.interface"); + str = g_settings_get_string (settings, "gtk-color-palette"); + g_object_unref (settings); + + if (str && *str) + g_strlcpy(color_palette, str, SIZE_OF_COLOR_PALETTE); + else + g_strlcpy(color_palette, DEFAULT_COLOR_PALETTE, SIZE_OF_COLOR_PALETTE); + + g_free (str); + } + mate_color_selection_palette_from_string (color_palette, &colors, &n_colors); @@ -2202,11 +2218,14 @@ default_change_palette_func (GdkScreen *screen, const GdkRGBA *colors, gint n_colors) { + GSettings *settings; gchar *str; str = mate_color_selection_palette_to_string (colors, n_colors); g_strlcpy(color_palette, str, SIZE_OF_COLOR_PALETTE); + settings = g_settings_new ("org.mate.interface"); + g_settings_set_string (settings, "gtk-color-palette", str); g_object_set (G_OBJECT (gtk_settings_get_for_screen (screen)), "gtk-color-palette", @@ -2214,6 +2233,7 @@ default_change_palette_func (GdkScreen *screen, NULL); g_free (str); + g_object_unref (settings); } /** diff --git a/schemas/org.mate.interface.gschema.xml b/schemas/org.mate.interface.gschema.xml index d30be52..2f67043 100644 --- a/schemas/org.mate.interface.gschema.xml +++ b/schemas/org.mate.interface.gschema.xml @@ -75,6 +75,11 @@ <summary>List of symbolic names and color equivalents</summary> <description>A '\n' separated list of "name:color" as defined by the 'gtk-color-scheme' setting</description> </key> + <key name="gtk-color-palette" type="s"> + <default>'#ef2929:#fcaf3e:#fce94f:#8ae234:#729fcf:#ad7fa8:#e9b96e:#888a85:#eeeeec:#cc0000:#f57900:#edd400:#73d216:#3465a4:#75507b:#c17d11:#555753:#d3d7cf:#a40000:#ce5c00:#c4a000:#4e9a06:#204a87:#5c3566:#8f5902:#2e3436:#babdb6:#000000:#2e3436:#555753:#888a85:#babdb6:#d3d7cf:#eeeeec:#f3f3f3:#ffffff'</default> + <summary>GTK color palette</summary> + <description>Default color palette for MATE Color Selection</description> + </key> <key name="font-name" type="s"> <default>'Sans 10'</default> <summary>Default font</summary> |