Interfacing Raku to Gnome GTK+

The Main Program

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env raku

use Gui;
use SkimFile;

sub MAIN ( Str $filename?, Str :$project-dir = $*CWD.Str ) {

  my Gui $gui .= new;

  if ?$filename and "$project-dir/$filename".IO.r {
    my SkimFile $sf .= new( :file-path("$project-dir/$filename"));
    $gui.add-file-data( $project-dir, $filename, $sf.mark-texts);
  }

  $gui.activate;
}

The main program is quite simple. It loads only two modules [3,4]. The program can be started with an optional filename where we expect some markers and comments and an option to specify the root of some project which is the current directory by default [6].

If there is a valid path to the filename [10], we instantiate the file skimmer to get the marker information [11]. Then the found data is fed to the user interface to be shown in a table[12].

When done, the user interface is activated, to only return when the interface is destroyed [15].