[gtk-web] Add correct import rules for code snippets



commit 435d31bf17a1c1fc68fe2f5575f9af31ba930c14
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Wed Feb 19 18:24:29 2020 +0000

    Add correct import rules for code snippets

 _data/sample_codes.yml | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/_data/sample_codes.yml b/_data/sample_codes.yml
index 8e57258..5fb1c69 100644
--- a/_data/sample_codes.yml
+++ b/_data/sample_codes.yml
@@ -3,6 +3,7 @@ codes:
     ext: javascript
     snippet: |
       ```javascript
+      imports.gi.versions['Gtk'] = '3.0';
       const Gtk = imports.gi.Gtk;
 
       // Create a new application
@@ -27,6 +28,9 @@ codes:
     ext: py
     snippet: |
       ```python
+      # Load Gtk
+      import gi
+      gi.require_version('Gtk', '3,0')
       from gi.repository import Gtk
 
       # When the application is launched…
@@ -80,6 +84,9 @@ codes:
     ext: c
     snippet: |
       ```cpp
+      // Include gtk
+      #include <gtk/gtk.h>
+
       static void on_activate (GtkApplication *app) {
         // Create a new window
         GtkWidget *window = gtk_application_window_new (app);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]