summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2014-06-26 14:56:41 +0200
committerStefano Karapetsas <[email protected]>2014-06-26 14:56:41 +0200
commitc3fc9b3e52b0c31c6c880b753ed370d9b6187c7b (patch)
treee569c3e61503945014420310e2a168fe2f064ec4
parent2e6259e8176c8ba29800c2716caa10d726e38ac3 (diff)
downloadmate-desktop-c3fc9b3e52b0c31c6c880b753ed370d9b6187c7b.tar.bz2
mate-desktop-c3fc9b3e52b0c31c6c880b753ed370d9b6187c7b.tar.xz
MateColorSelection: Use colors from GTK3 palette
-rw-r--r--libmate-desktop/mate-colorsel.c40
-rw-r--r--tools/mate-color-select.c2
2 files changed, 8 insertions, 34 deletions
diff --git a/libmate-desktop/mate-colorsel.c b/libmate-desktop/mate-colorsel.c
index 489dcc7..9586952 100644
--- a/libmate-desktop/mate-colorsel.c
+++ b/libmate-desktop/mate-colorsel.c
@@ -35,12 +35,11 @@
#include <glib/gi18n-lib.h>
#include "mate-colorsel.h"
-/* Keep it in sync with gtksettings.c:default_color_palette */
-#define DEFAULT_COLOR_PALETTE "black:white:gray50:red:purple:blue:light blue:green:yellow:orange:lavender:brown:goldenrod4:dodger blue:pink:light green:gray10:gray30:gray75:gray90"
+#define DEFAULT_COLOR_PALETTE "#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"
/* Number of elements in the custom palatte */
-#define GTK_CUSTOM_PALETTE_WIDTH 10
-#define GTK_CUSTOM_PALETTE_HEIGHT 2
+#define GTK_CUSTOM_PALETTE_WIDTH 9
+#define GTK_CUSTOM_PALETTE_HEIGHT 4
#define CUSTOM_PALETTE_ENTRY_WIDTH 20
#define CUSTOM_PALETTE_ENTRY_HEIGHT 20
@@ -1245,42 +1244,15 @@ palette_drag_end (GtkWidget *widget,
static GdkColor *
get_current_colors (MateColorSelection *colorsel)
{
- GtkSettings *settings;
GdkColor *colors = NULL;
gint n_colors = 0;
- gchar *palette;
- settings = gtk_widget_get_settings (GTK_WIDGET (colorsel));
- g_object_get (settings, "gtk-color-palette", &palette, NULL);
-
- if (!mate_color_selection_palette_from_string (palette, &colors, &n_colors))
- {
- mate_color_selection_palette_from_string (DEFAULT_COLOR_PALETTE,
- &colors,
- &n_colors);
- }
- else
- {
- /* If there are less colors provided than the number of slots in the
- * color selection, we fill in the rest from the defaults.
- */
- if (n_colors < (GTK_CUSTOM_PALETTE_WIDTH * GTK_CUSTOM_PALETTE_HEIGHT))
- {
- GdkColor *tmp_colors = colors;
- gint tmp_n_colors = n_colors;
-
- mate_color_selection_palette_from_string (DEFAULT_COLOR_PALETTE,
- &colors,
- &n_colors);
- memcpy (colors, tmp_colors, sizeof (GdkColor) * tmp_n_colors);
-
- g_free (tmp_colors);
- }
- }
+ mate_color_selection_palette_from_string (DEFAULT_COLOR_PALETTE,
+ &colors,
+ &n_colors);
/* make sure that we fill every slot */
g_assert (n_colors == GTK_CUSTOM_PALETTE_WIDTH * GTK_CUSTOM_PALETTE_HEIGHT);
- g_free (palette);
return colors;
}
diff --git a/tools/mate-color-select.c b/tools/mate-color-select.c
index 5ef4785..ed4f18c 100644
--- a/tools/mate-color-select.c
+++ b/tools/mate-color-select.c
@@ -49,6 +49,8 @@ main (int argc, char **argv)
color_dialog = mate_color_selection_dialog_new (_("MATE Color Selection"));
#endif
+ mate_color_selection_set_has_palette (MATE_COLOR_SELECTION_DIALOG (color_dialog)->colorsel, TRUE);
+
/* quit signal */
g_signal_connect (color_dialog, "destroy", gtk_main_quit, NULL);