GList *children, *l;
GtkWidget *widget;
+ if (cc->priv->current != NULL &&
+ gtk_widget_get_parent (GTK_WIDGET (cc->priv->current)) != cc->priv->custom)
+ cc->priv->current = NULL;
+
children = gtk_container_get_children (GTK_CONTAINER (cc->priv->palette));
for (l = children; l; l = l->next)
{
static void
add_palette (GtkColorChooserWidget *cc,
- gboolean horizontal,
+ GtkOrientation orientation,
gint colors_per_line,
gint n_colors,
GdkRGBA *colors,
line = i / colors_per_line;
pos = i % colors_per_line;
- if (horizontal)
+ if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
if (pos == left)
gtk_style_context_add_class (gtk_widget_get_style_context (p), GTK_STYLE_CLASS_LEFT);
for (j = 0; j < 3; j++)
gdk_rgba_parse (&colors[i*3 + j], default_colors[i][j]);
- add_palette (cc, FALSE, 3, 9*3, colors, color_names);
+ add_palette (cc, GTK_ORIENTATION_VERTICAL, 3, 9*3, colors, color_names);
for (i = 0; i < 9; i++)
gdk_rgba_parse (&colors[i], default_grays[i]);
- add_palette (cc, TRUE, 9, 9, colors, gray_names);
+ add_palette (cc, GTK_ORIENTATION_HORIZONTAL, 9, 9, colors, gray_names);
cc->priv->has_default_palette = TRUE;
}
gtk_color_swatch_set_icon (GTK_COLOR_SWATCH (button), "list-add-symbolic");
gtk_container_add (GTK_CONTAINER (box), button);
- cc->priv->settings = g_settings_new_with_path ("org.gtk.Settings.ColorChooser",
- "/org/gtk/settings/color-chooser/");
+ cc->priv->settings = g_settings_new ("org.gtk.Settings.ColorChooser");
variant = g_settings_get_value (cc->priv->settings, "custom-colors");
g_variant_iter_init (&iter, variant);
i = 0;
{
select_swatch (cc, swatch);
g_list_free (children);
+ g_list_free (palettes);
return;
}
}
static void
gtk_color_chooser_widget_add_palette (GtkColorChooser *chooser,
- gboolean horizontal,
+ GtkOrientation orientation,
gint colors_per_line,
gint n_colors,
GdkRGBA *colors)
GtkColorChooserWidget *cc = GTK_COLOR_CHOOSER_WIDGET (chooser);
remove_default_palette (cc);
- add_palette (cc, horizontal, colors_per_line, n_colors, colors, NULL);
+ add_palette (cc, orientation, colors_per_line, n_colors, colors, NULL);
}
static void