Hi, Sascha, I've figured out (with some help from StackExchange) how to make this work. You need to: a) Install glade (v3.20) b) Install Gtk+3 (pacman -S gtk3 or apt install libgtk3...) c) Now in MonoDevelop, add the NuGet package Gtk#3 to your project. d) GtkBuilder will work.
This works in Linux, I haven't figured out how to do it in Windows. -- Baltasar El mié., 18 ene. 2017 a las 12:58, Baltasar García Perez-Schofield (< baltas...@gmail.com>) escribió: > Hi, Sascha, > > i've written a new GUI for my program with Glade and Gtk.Builder. > > Err... why? Nevermind. > > Actually i'm having that constructors: > > public static PublicanCreators Create() > { > Builder builder = new Builder(); > builder.AddFromFile("gui.glade"); > return new PublicanCreators(builder, > builder.GetObject("PublicanCreators").Handle); > }protected PublicanCreators(Builder builder, IntPtr handle) : base(handle){ > _builder = builder; > builder.Autoconnect(this); > SetupHandlers();} > > I don't have much experience with Glade 3, and Gtk 3. Glade 3 uses Gtk+ 3, > while Gtk# uses Gtk+2, so at first glance, they are incompatible. > > I've found this answer in stack overflow: > > http://stackoverflow.com/questions/15599497/how-do-i-use-gtk-builder-in-c-sharp#19352159 > > They seem to be able to build a user interface using both methods: with > Gtk.Builder, and with libglade (Glade.XML). > > I've tried both. Using the libglade method, I was able to make the program > compile and run, even with the glade XML file as a resource (this is a must > to me). > > == > public Ppal() > { > Gtk.Application.Init(); > var uiInterface = > new Glade.XML( "GladeTest.Res.glade_test-ui.glade", "AppWindow" ); > uiInterface.Autoconnect( this ); > Gtk.Application.Run(); > } > == > > Unfortunately, nothing shows on screen. I double-checked that the > GtkWindow had the Visible property set to true. Then I checked the output, > to find: > == > (GladeTest:7658): libglade-WARNING **: Expected <glade-interface>. Got > <interface>. > > (GladeTest:7658): libglade-WARNING **: did not finish in PARSER_FINISH > state! > > (GladeTest:7658): libglade-CRITICAL **: glade_xml_get_widget: assertion > 'self != NULL' failed > > (GladeTest:7658): libglade-CRITICAL **: glade_xml_signal_autoconnect_full: > assertion 'self != NULL' failed > == > > It seems that the XML format generated by Glade is not the expected by > libglade. > > So libglade does not work... what about Gtk.Builder? The same app, with > the same user interface generated by Glade. > > == > public Ppal() > { > Gtk.Application.Init(); > var guiBuilder = new Gtk.Builder(); > StreamReader uiFile = new StreamReader( > System.Reflection.Assembly.GetEntryAssembly(). > GetManifestResourceStream( "GladeTest.Res.glade_test-ui.glade" ) ) > ; > > guiBuilder.AddFromString( uiFile.ReadToEnd() ); > * // ERROR autoconnect does not exist * > > * //guiBuilder.Autoconnect( this );* > Gtk.Application.Run(); > } > == > > The problem with Builder is twofold: a) there is not an "autoconnect" > method, and b) (and most important) the execution fails while executing > AddFromString(), with a Glib.GException with message "<input>: required > gtk+ version 3.0, current version is 2.24" > > This is actually the problem I had foreseen, they are not compatible since > Gtk# is stuck in Gtk+2. It requires gtk+3.0 because I messed with the > settings, by default it requires gtk+3.20. > > Maybe someone can provide more info about this issue, perhaps a workaround > or something. I'm using Mono 4.6.2. > > -- Baltasar > >
_______________________________________________ Gtk-sharp-list maillist - Gtk-sharp-list@lists.dot.net http://lists.dot.net/mailman/listinfo/gtk-sharp-list