やってみる

アウトプットすべく己を導くためのブログ。その試行錯誤すらたれ流す。

MonoDevelop Gtk# 2.0 プロジェクトで GtkSourceView コントロールを使えなかった

 残念。

前回

対象環境

手順

 前々回のプロジェクトを参照して、新しいプロジェクトを追加してみる。Eto.CodeEditor.Wpf

1. プロジェクト作成

  1. MonoDevelopを起動する
  2. メニュー→ファイル新しいソリューション
    f:id:ytyaru:20181201194454p:plain
  3. その他.NETGTK#2.0プロジェクト f:id:ytyaru:20181217192902p:plain
  4. 名前などを適当に入力する (HelloGtkSourceView)
  5. プロジェクトが作成される

 コードにGtkSourceViewと書いてもインテリセンスで表示されない。

2. ビルドするとエラー

f:id:ytyaru:20181217193015p:plain

 原因はメモリ不足。

3. NuGetでGtk#3.0を追加

  1. メニュー→プロジェクトNuGet パッケージの追加
    f:id:ytyaru:20181201194958p:plain
  2. パッケージを追加ダイアログから欲しいパッケージを探す
    f:id:ytyaru:20181201195154p:plain
  3. 検索窓にgtk 3と入力して絞り込む
  4. gtk-sharp-3を選択しパッケージを追加ボタンをクリックする
    f:id:ytyaru:20181217193304p:plain
  5. 同意する f:id:ytyaru:20181217193318p:plain f:id:ytyaru:20181217193326p:plain f:id:ytyaru:20181217193337p:plain

 プロジェクトが壊れてビルドできなくなる。

libgtksourceview はインストールされていた

 libgtksourceview-3.0-1はインストールされていた。これをMonoDevelop C#で使えればいいのだが、情報がまるで見つからない。

$ apt search libgtksourceview
ソート中... 完了
全文検索... 完了  
libgtksourceview-3.0-1/stable,stable,stable,stable,now 3.22.2-1 armhf [インストール済み、自動]
  shared libraries for the GTK+ syntax highlighting widget

libgtksourceview-3.0-common/stable,stable,stable,stable,now 3.22.2-1 all [インストール済み、自動]
  common files for the GTK+ syntax highlighting widget

libgtksourceview-3.0-dev/stable,stable,stable,stable 3.22.2-1 armhf
  development files for the GTK+ syntax highlighting widget

libgtksourceview-3.0-doc/stable,stable,stable,stable 3.22.2-1 all
  documentation for the GTK+ syntax highlighting widget

libgtksourceview2.0-0/stable,stable,stable,stable 2.10.5-3 armhf
  shared libraries for the GTK+ syntax highlighting widget

libgtksourceview2.0-common/stable,stable,stable,stable 2.10.5-3 all
  common files for the GTK+ syntax highlighting widget

libgtksourceview2.0-dev/stable,stable,stable,stable 2.10.5-3 armhf
  development files for the GTK+ syntax highlighting widget

libgtksourceview2.0-doc/stable,stable,stable,stable 2.10.5-3 all
  documentation for the GTK+ syntax highlighting widget

libgtksourceviewmm-3.0-0v5/stable,stable,stable,stable 3.18.0-1 armhf
  C++ binding of GtkSourceView

libgtksourceviewmm-3.0-dbg/stable,stable,stable,stable 3.18.0-1 armhf
  C++ binding of GtkSourceView - debugging symbols

libgtksourceviewmm-3.0-dev/stable,stable,stable,stable 3.18.0-1 armhf
  C++ binding of GtkSourceView - development files

libgtksourceviewmm-3.0-doc/stable,stable,stable,stable 3.18.0-1 all
  C++ binding of GtkSourceView

liblablgtksourceview2-ocaml/stable,stable,stable,stable 2.18.3+dfsg-2 armhf
  OCaml bindings for libgtksourceview2 (runtime)

liblablgtksourceview2-ocaml-dev/stable,stable,stable,stable 2.18.3+dfsg-2 armhf
  OCaml bindings for libgtksourceview2, a source editor GTK+ widget

参考

using GtkSourceView;

SourceLanguagesManager manager = new SourceLanguagesManager ();
SourceLanguage language = manager.GetLanguageFromMimeType ("text/x-csharp");
SourceBuffer buffer = new SourceBuffer (language);
buffer.Highlight = true;
SourceView view = new SourceView (buffer);

所感

 GtkSourceViewをどうやれば参照できるかわからん。