mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 10:50:10 +00:00
tests: Drop testcolorchooser2
This tests an embedded colorchooser. Just like we have in widget-factory. And it doesn't work in !srcdir builds, so it can go. See: #2738
This commit is contained in:
parent
1420e846b5
commit
604f4cf8bf
@ -22,7 +22,6 @@ gtk_tests = [
|
||||
['testcalendar'],
|
||||
['testclipboard2'],
|
||||
['testcolorchooser'],
|
||||
['testcolorchooser2'],
|
||||
['testcombo'],
|
||||
['testcombochange'],
|
||||
['testcellrenderertext'],
|
||||
|
@ -1,60 +0,0 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static void rgba_changed (GtkColorChooser *chooser, GParamSpec *pspec, gpointer data);
|
||||
|
||||
static void
|
||||
text_activated (GtkEntry *entry, gpointer data)
|
||||
{
|
||||
GtkColorChooser *chooser = data;
|
||||
GdkRGBA rgba;
|
||||
const char *text;
|
||||
|
||||
text = gtk_editable_get_text (GTK_EDITABLE (entry));
|
||||
|
||||
g_signal_handlers_block_by_func (entry, rgba_changed, entry);
|
||||
if (gdk_rgba_parse (&rgba, text))
|
||||
gtk_color_chooser_set_rgba (chooser, &rgba);
|
||||
g_signal_handlers_unblock_by_func (entry, rgba_changed, entry);
|
||||
}
|
||||
|
||||
static void
|
||||
rgba_changed (GtkColorChooser *chooser, GParamSpec *pspec, gpointer data)
|
||||
{
|
||||
GtkWidget *entry = data;
|
||||
GdkRGBA color;
|
||||
char *s;
|
||||
|
||||
gtk_color_chooser_get_rgba (chooser, &color);
|
||||
s = gdk_rgba_to_string (&color);
|
||||
|
||||
g_signal_handlers_block_by_func (entry, text_activated, chooser);
|
||||
gtk_editable_set_text (GTK_EDITABLE (entry), s);
|
||||
g_signal_handlers_unblock_by_func (entry, text_activated, chooser);
|
||||
|
||||
g_free (s);
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *chooser;
|
||||
GtkWidget *entry;
|
||||
GtkBuilder *builder;
|
||||
|
||||
gtk_init ();
|
||||
|
||||
builder = gtk_builder_new_from_file ("testcolorchooser2.ui");
|
||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
|
||||
chooser = GTK_WIDGET (gtk_builder_get_object (builder, "chooser"));
|
||||
entry = GTK_WIDGET (gtk_builder_get_object (builder, "entry"));
|
||||
|
||||
g_signal_connect (chooser, "notify::rgba", G_CALLBACK (rgba_changed), entry);
|
||||
g_signal_connect (entry, "activate", G_CALLBACK (text_activated), chooser);
|
||||
|
||||
gtk_widget_show (window);
|
||||
|
||||
while (TRUE)
|
||||
g_main_context_iteration (NULL, TRUE);
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkWindow" id="window1">
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">1</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkEntry" id="entry">
|
||||
<property name="visible">1</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="text">unknown</property>
|
||||
<property name="width-chars">25</property>
|
||||
<property name="max-width-chars">25</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkColorChooserWidget" id="chooser">
|
||||
<property name="visible">1</property>
|
||||
<property name="show-editor">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
Loading…
Reference in New Issue
Block a user