diff --git a/extra/gir/samples/lowlevel/lowlevel.factor b/extra/gir/samples/lowlevel/lowlevel.factor deleted file mode 100644 index 795d3cfba4..0000000000 --- a/extra/gir/samples/lowlevel/lowlevel.factor +++ /dev/null @@ -1,78 +0,0 @@ -! Copyright (C) 2010 Anton Gorenko. -! See http://factorcode.org/license.txt for BSD license. -USING: alien.c-types alien.strings byte-arrays classes.struct -glib.ffi gobject.ffi gtk.ffi io.encodings.utf8 kernel -literals locals make math prettyprint sequences specialized-arrays -gir.samples.lowlevel.hello-world -gir.samples.lowlevel.opengl -gir.samples.lowlevel.gstreamer ; -IN: gir.samples.lowlevel - -SPECIALIZED-ARRAY: ulong - -CONSTANT: samples { - { "hello-world" "Simple 'Hello world!' program" [ hello-world-win ] } - { "opengl" "GtkGLExt sample program" [ opengl-win ] } - { "gstreamer" "Small GStreamer-based multimedia player " [ gstreamer-win ] } -} - -:: list-on-row-activited ( sender path column user_data -- ) - path gtk_tree_path_get_indices *int samples nth last - call( -- win ) gtk_widget_show_all ; - -:: main ( -- ) - f f gtk_init - - GTK_WINDOW_TOPLEVEL gtk_window_new :> window - - window - [ "Low-level Gtk samples" utf8 string>alien gtk_window_set_title ] - [ 300 400 gtk_window_set_default_size ] - [ GTK_WIN_POS_CENTER gtk_window_set_position ] tri - - gtk_tree_view_new :> list - list f gtk_tree_view_set_headers_visible - - gtk_cell_renderer_text_new :> renderer - gtk_tree_view_column_new :> column - column "Sample" utf8 string>alien gtk_tree_view_column_set_title - column renderer t gtk_tree_view_column_pack_start - column renderer "markup" utf8 string>alien 0 gtk_tree_view_column_add_attribute - list column gtk_tree_view_append_column drop - - ulong-array{ $ G_TYPE_STRING } - [ length ] keep gtk_list_store_newv :> store - - list store gtk_tree_view_set_model - - store g_object_unref - - GtkTreeIter :> iter - GValue :> value - value G_TYPE_STRING g_value_init drop - samples [ - first2 swap [ "" % % "\n" % % ] "" make - value swap utf8 string>alien g_value_set_string - store iter gtk_list_store_append - store iter 0 value gtk_list_store_set_value - ] each - - list 300 300 gtk_widget_set_size_request - - window list gtk_container_add - - list "row-activated" - utf8 string>alien - [ list-on-row-activited ] GtkTreeView:row-activated - f f 0 g_signal_connect_data drop - - window "destroy" utf8 string>alien - [ 2drop gtk_main_quit ] GtkObject:destroy - f f 0 g_signal_connect_data drop - - window gtk_widget_show_all - - gtk_main ; - -MAIN: main - diff --git a/extra/gir/samples/lowlevel/opengl/authors.txt b/extra/gir/samples/lowlevel/opengl/authors.txt deleted file mode 100644 index ce9bcc8313..0000000000 --- a/extra/gir/samples/lowlevel/opengl/authors.txt +++ /dev/null @@ -1 +0,0 @@ -Anton Gorenko \ No newline at end of file diff --git a/extra/gir/samples/lowlevel/authors.txt b/extra/gtk-samples/hello-world/authors.txt similarity index 100% rename from extra/gir/samples/lowlevel/authors.txt rename to extra/gtk-samples/hello-world/authors.txt diff --git a/extra/gir/samples/lowlevel/hello-world/hello-world.factor b/extra/gtk-samples/hello-world/hello-world.factor similarity index 77% rename from extra/gir/samples/lowlevel/hello-world/hello-world.factor rename to extra/gtk-samples/hello-world/hello-world.factor index b1bcf029d5..fd0b609160 100644 --- a/extra/gir/samples/lowlevel/hello-world/hello-world.factor +++ b/extra/gtk-samples/hello-world/hello-world.factor @@ -2,8 +2,11 @@ ! See http://factorcode.org/license.txt for BSD license. USING: alien.strings gobject.ffi gtk.ffi io.encodings.utf8 kernel locals ; -IN: gir.samples.lowlevel.hello-world +IN: gtk-samples.hello-world +: on-button-clicked ( button label-user-data -- ) + nip "Hello! :)" utf8 string>alien gtk_label_set_text ; + :: hello-world-win ( -- window ) GTK_WINDOW_TOPLEVEL gtk_window_new :> window @@ -23,8 +26,8 @@ IN: gir.samples.lowlevel.hello-world frame label 120 110 gtk_fixed_put button "clicked" utf8 string>alien - [ nip "Hello! :)" utf8 string>alien gtk_label_set_text t ] GtkButton:clicked - label f 0 g_signal_connect_data drop + [ on-button-clicked ] GtkButton:clicked label + g_signal_connect drop window ; @@ -33,8 +36,8 @@ IN: gir.samples.lowlevel.hello-world hello-world-win :> window window "destroy" utf8 string>alien - [ 2drop gtk_main_quit ] GtkObject:destroy - f f 0 g_signal_connect_data drop + [ 2drop gtk_main_quit ] GtkObject:destroy f + g_signal_connect drop window gtk_widget_show_all diff --git a/extra/gir/samples/lowlevel/hello-world/authors.txt b/extra/gtk-samples/opengl/authors.txt similarity index 100% rename from extra/gir/samples/lowlevel/hello-world/authors.txt rename to extra/gtk-samples/opengl/authors.txt diff --git a/extra/gir/samples/lowlevel/opengl/opengl.factor b/extra/gtk-samples/opengl/opengl.factor similarity index 91% rename from extra/gir/samples/lowlevel/opengl/opengl.factor rename to extra/gtk-samples/opengl/opengl.factor index 52d658c0b8..619e95ede5 100644 --- a/extra/gir/samples/lowlevel/opengl/opengl.factor +++ b/extra/gtk-samples/opengl/opengl.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: alien.strings gdk.gl.ffi gobject.ffi gtk.ffi gtk.gl.ffi io.encodings.utf8 kernel locals opengl.gl ; -IN: gir.samples.lowlevel.opengl +IN: gtk-samples.opengl ! This sample is based on ! http://code.valaide.org/content/simple-opengl-sample-using-gtkglext @@ -55,12 +55,12 @@ IN: gir.samples.lowlevel.opengl gtk_widget_set_gl_capability drop window "configure-event" utf8 string>alien - [ on-configure ] GtkWidget:configure-event - f f 0 g_signal_connect_data drop + [ on-configure ] GtkWidget:configure-event f + g_signal_connect drop window "expose-event" utf8 string>alien - [ on-expose ] GtkWidget:expose-event - f f 0 g_signal_connect_data drop + [ on-expose ] GtkWidget:expose-event f + g_signal_connect drop window ;