From: Marijn van Vliet Date: Mon, 24 Sep 2012 09:37:17 +0000 (+0200) Subject: Merge branch 'gtk3' of ssh://git.stderr.nl/projects/chimara/chimara into gtk3 X-Git-Url: https://git.stderr.nl/gitweb?p=projects%2Fchimara%2Fchimara.git;a=commitdiff_plain;h=0b4fd82c4380dfdbd8e4bd37e1b4aa9907a1b187;hp=61c8977d3b757bbe8ebdfe9e2241a085a8991d01 Merge branch 'gtk3' of ssh://git.stderr.nl/projects/chimara/chimara into gtk3 --- diff --git a/COPYING b/COPYING index eb40986..976f4da 100644 --- a/COPYING +++ b/COPYING @@ -1,4 +1,4 @@ -Copyright (C) 2010, Philip Chimento and Marijn van Vliet. +Copyright (C) 2012, Philip Chimento and Marijn van Vliet. All rights reserved. Chimara is free software copyrighted by Philip Chimento and Marijn van Vliet. @@ -9,19 +9,19 @@ are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation + this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -3. Neither of the names Philip Chimento or Marijn van Vliet, nor the name of any - other contributor may be used to endorse or promote products derived from +3. Neither of the names Philip Chimento or Marijn van Vliet, nor the name of any + other contributor may be used to endorse or promote products derived from this software without specific prior written permission. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/ChangeLog b/ChangeLog index 17318ff..a366387 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1 +1 @@ -(to do before release) \ No newline at end of file +Please refer to `git log' for the change log. \ No newline at end of file diff --git a/NEWS b/NEWS index 17318ff..0fde9c9 100644 --- a/NEWS +++ b/NEWS @@ -1 +1,3 @@ -(to do before release) \ No newline at end of file +2012-xx-xx: Release 0.99 +======================== +- First public release. \ No newline at end of file diff --git a/tests/Makefile.am b/tests/Makefile.am index 6d12176..aacfc6e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -10,7 +10,7 @@ TEST_PLUGIN_LIBTOOL_FLAGS = \ -export-symbols-regex "^glk_main$$" \ -rpath $(abs_builddir) -noinst_PROGRAMS = test-multisession glulxercise plugin-loader test-close +noinst_PROGRAMS = test-multisession glulxercise plugin-loader test-close csstest test_multisession_SOURCES = test-multisession.c test_multisession_CFLAGS = @TEST_CFLAGS@ $(AM_CFLAGS) @@ -29,6 +29,10 @@ test_close_SOURCES = test-close.c test_close_CFLAGS = @TEST_CFLAGS@ $(AM_CFLAGS) test_close_LDADD = @TEST_LIBS@ $(top_builddir)/libchimara/libchimara.la +csstest_SOURCES = csstest.c +csstest_CFLAGS = @TEST_CFLAGS@ $(AM_CFLAGS) +csstest_LDADD = @TEST_LIBS@ $(top_builddir)/libchimara/libchimara.la + noinst_LTLIBRARIES = first.la model.la gridtest.la splittest.la multiwin.la \ styletest.la soundtest.la test-userstyle.la fileio.la diff --git a/tests/csstest.c b/tests/csstest.c new file mode 100644 index 0000000..28cbabe --- /dev/null +++ b/tests/csstest.c @@ -0,0 +1,105 @@ +#include +#include + +/* This is a test program for CSS styling of the Glk program, which is not +implemented so far. */ + +/* Style the GUI funky */ +void +style1(GtkButton *button, GtkStyleProvider *funky_provider) +{ + gtk_style_context_add_provider_for_screen(gdk_screen_get_default(), funky_provider, GTK_STYLE_PROVIDER_PRIORITY_USER); +} + +/* Style the GUI nicely */ +void +style2(GtkButton *button, GtkStyleProvider *funky_provider) +{ + gtk_style_context_remove_provider_for_screen(gdk_screen_get_default(), funky_provider); +} + +int +main(int argc, char **argv) +{ + gdk_threads_init(); + gtk_init(&argc, &argv); + + /* Create widgets */ + GtkWidget *win = gtk_window_new(GTK_WINDOW_TOPLEVEL); + GtkWidget *grid = gtk_grid_new(); + GtkWidget *glk = chimara_glk_new(); + GtkWidget *stylebutton1 = gtk_button_new_with_label("Style 1"); + GtkWidget *stylebutton2 = gtk_button_new_with_label("Style 2"); + GtkCssProvider *funky_provider = gtk_css_provider_new(); + + /* Set properties on widgets */ + gtk_widget_set_size_request(win, 400, 400); + g_object_set(glk, "expand", TRUE, NULL); + GError *error = NULL; + gboolean res = gtk_css_provider_load_from_data(funky_provider, + ".glk grid {" + " font-size: 14;" + " color: #303030;" + " font-family: \"Andale Mono\";" + "}\n" + ".glk buffer {" + " color: #303030;" + " font-size: 14;" + " margin-bottom: 5px;" + " font-family: \"Book Antiqua\";" + "}\n" + ".glk buffer.header { font-weight: bold; }\n" + ".glk buffer.alert {" + " color: #aa0000;" + " font-weight: bold;" + "}\n" + ".glk buffer.note {" + " color: #aaaa00;" + " font-weight: bold;" + "}\n" + ".glk buffer.block-quote {" + " /*text-align: center;*/" + " font-style: italic;" + "}\n" + ".glk buffer.input {" + " color: #0000aa;" + " font-style: italic;" + "}\n" + ".glk blank { background-color: #4e702a; }\n" + ".glk graphics {" + " background-image: -gtk-gradient(linear, 0 0, 0 1," + " color-stop(0, @yellow)," + " color-stop(0.2, @blue)," + " color-stop(1, #0f0));" + "}", + -1, &error); + if(!res) + g_printerr("Error: %s\n", error->message); + + /* Put widgets together */ + gtk_grid_attach(GTK_GRID(grid), stylebutton1, 0, 0, 1, 1); + gtk_grid_attach_next_to(GTK_GRID(grid), stylebutton2, NULL, GTK_POS_RIGHT, 1, 1); + gtk_grid_attach(GTK_GRID(grid), glk, 0, 1, 2, 1); + gtk_container_add(GTK_CONTAINER(win), grid); + + /* Connect signals */ + g_signal_connect(win, "delete-event", G_CALLBACK(gtk_main_quit), NULL); + g_signal_connect(stylebutton1, "clicked", G_CALLBACK(style1), funky_provider); + g_signal_connect(stylebutton2, "clicked", G_CALLBACK(style2), funky_provider); + + /* Go! */ + gtk_widget_show_all(win); + g_object_ref(glk); + char *plugin_argv[] = { "styletest" }; + chimara_glk_run(CHIMARA_GLK(glk), ".libs/styletest.so", 1, plugin_argv, NULL); + + gdk_threads_enter(); + gtk_main(); + gdk_threads_leave(); + + chimara_glk_stop(CHIMARA_GLK(glk)); + chimara_glk_wait(CHIMARA_GLK(glk)); + g_object_unref(glk); + g_object_unref(funky_provider); + return 0; +} \ No newline at end of file