mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-06 00:30:08 +00:00
testcolorchooser: Add more options
Add a --edit option that brings the color chooser up in single-color edit mode right away.
This commit is contained in:
parent
cb128cc6e9
commit
ed5aa953d5
@ -34,15 +34,26 @@ int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
gint i;
|
||||
|
||||
gtk_init (NULL, NULL);
|
||||
|
||||
dialog = gtk_color_chooser_dialog_new ("Select a color", NULL);
|
||||
if (argc > 1 && g_strcmp0 (argv[1], "--no-alpha") == 0)
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
g_print ("turning alpha off\n");
|
||||
gtk_color_chooser_set_use_alpha (GTK_COLOR_CHOOSER (dialog), FALSE);
|
||||
if (g_strcmp0 (argv[i], "--no-alpha") == 0)
|
||||
{
|
||||
g_print ("turning alpha off\n");
|
||||
gtk_color_chooser_set_use_alpha (GTK_COLOR_CHOOSER (dialog), FALSE);
|
||||
}
|
||||
else if (g_strcmp0 (argv[i], "--edit") == 0)
|
||||
{
|
||||
g_print ("starting in edit mode\n");
|
||||
g_object_set (dialog, "show-editor", TRUE, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
g_signal_connect (dialog, "notify::color", G_CALLBACK (color_changed), NULL);
|
||||
g_signal_connect (dialog, "response", G_CALLBACK (dialog_response), NULL);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user