GNOME Bugzilla – Bug 530740
Use GtkBuilder instead of libglade
Last modified: 2009-07-26 14:51:43 UTC
libglade is deprecated. Migration instructions are overhere http://library.gnome.org/devel/gtk/stable/gtk-migrating-GtkBuilder.html glade3 in SVN trunk now also support GtkBuilder files. The most common extension for builder files is .ui. Anjuta now uses these for UIManager files. Most other apps use <name>-ui.xml for these files.
Hmm, can't find that it is deprecated: http://live.gnome.org/TwoPointTwentythree/Platform We will adapt this some time in the future but currently glade3 trunk is not stable enough for general development and there is not much benefit in migrating now. We will try to get gio in place for this release which will be enough work. Maybe we can also get rid of libgnome though that could become very hard.
With cheese we have both the glade file and the builder file in SVN. We use the glade file still with glade and then simply run gtk-builder-convert to produce the builder file. I just saw that GtkBuilder actually misses some functions which would be really handy to have to make migration easy. glade_xml_get_widget_prefix glade_get_widget_name I filed bug 530748 for this. Let's see if these functions get into gtk after that I can help with migration
I have used GtkBuilder in the project wizard plugin. Converting the other plugins shouldn't be very difficult, but I think there is no urgency.
If I create a GtkBuilder UI in the Glade plugin and then save it (with a “.ui” extension), I now cannot open it again; Anjuta always wants to use the text editor if I open the file from the file manager. Perhaps this should be a separate bug, I don’t know. Anyway, though GTKBuilder support is still rudimentary, it seems silly to have it closed off entirely.
(In reply to comment #4) > If I create a GtkBuilder UI in the Glade plugin and then save it (with a > “.ui” extension), I now cannot open it again; Anjuta always wants to use > the text editor if I open the file from the file manager. Perhaps this should > be a separate bug, I don’t know. Anyway, though GTKBuilder support is still > rudimentary, it seems silly to have it closed off entirely. > Hmm, actually it works after assigning ui files to glade in Nautilus. The glade plugin claims to support application/x-designer as mime-type. Don't know exactly why it doesn't work from the beginning, probably a gio-issue.
I found the problem! There's something in the code that tells Anjuta to ignore the mimetype on files whose names end with ".ui", and assume they are XML files. I changed the assumed MIME type to "application/x-designer" and it worked, though I'd imagine removing the line would work better. (Sorry, I don't remember where in the code it was... I should have brought this up sooner)
OK, this is now fixed for the sourceview plugin and the preference system. That means all plugins can be ported rather easy.
Created attachment 132504 [details] [review] patch for this bug With this patch, this is fixed for: build-basic-autotools, class-gen, document-manager, file-manager, file-wizard, language-support-cpp-java, message-view, patch, project-import, search, symbol-db, terminal, run-program.
Created attachment 132517 [details] [review] corrected patch
Created attachment 132915 [details] [review] patch for this bug (1MB) Port all plugin to GtkBuilder (except git, cvs-plugin)
Thanks a lot! The patch looks good but some things need to be adjusted: - Please rename the GtkBuilder files into *.ui and rename the old *.ui files into *.xml. That's not pretty consistent but it's the best we can do at the moment and seems consistent with most GNOME modules - Fix the schemas generation in the Makefile.am, you can take plugins/sourceview/Makefile.am as an example on how to generate the schemas correctly. You can also use gzip to compress the patch but please set the mime-type correctly in bugzilla then.
Created attachment 133191 [details] corrected patch (.tgz) glade & ui files renamed. Corrected schemas generation.
Committed last patch! Thanks a lot. Would be cool if you could also fix git and cvs and check if everything builds without libglade!
Created attachment 135053 [details] [review] patch for this bug With this patch, everything can be build without libglade(except libanjuta - anjuta_preferences_add_page)
Thanks! Some will need to port the plugins in anjuta-extras so we can remove anjuta_preferences_add_page().
Created attachment 135211 [details] [review] patch for anjuta-extras
Removed the remaining libglade bits from anjuta and applied patch - Thanks!
Compiling valgrind I get: make: *** No rule to make target `anjuta-valgrind.xml', needed by `all-am'. Stop. Should the anjuta-valgrind.ui be renamed into anjuta-valgrind.xml?
I'm reopening this bug because the simple `mv anjuta-valgrind.xml anjuta-valgrind.ui` doesn't work as expected.
The profiler plugin has compiling problems too: In file included from plugin.c:25: plugin.h:63: error: expected specifier-qualifier-list before ‘GladeXML’ plugin.c: In function ‘setup_options’: plugin.c:137: error: ‘Profiler’ has no member named ‘profile_data_monitor’ plugin.c:141: error: ‘Profiler’ has no member named ‘profile_data_monitor’ plugin.c:142: error: ‘Profiler’ has no member named ‘profile_data_monitor’ plugin.c:143: error: ‘Profiler’ has no member named ‘profile_data_monitor’ plugin.c: In function ‘profiler_get_data’: plugin.c:159: error: ‘Profiler’ has no member named ‘profile_target_path’ plugin.c:172: error: ‘Profiler’ has no member named ‘profile_data’ plugin.c:173: error: ‘Profiler’ has no member named ‘profile_target_path’ plugin.c: In function ‘on_profile_data_changed’: plugin.c:210: error: ‘Profiler’ has no member named ‘view_manager’ plugin.c:214: error: ‘Profiler’ has no member named ‘profile_data_monitor’ plugin.c:215: error: ‘Profiler’ has no member named ‘profile_data_monitor’ plugin.c: In function ‘profiler_set_target’: plugin.c:232: error: ‘Profiler’ has no member named ‘profile_target_path’ plugin.c:234: error: ‘Profiler’ has no member named ‘profile_target_path’ plugin.c:235: error: ‘Profiler’ has no member named ‘profile_target_path’ plugin.c:265: error: ‘Profiler’ has no member named ‘profile_target_path’ plugin.c:273: error: ‘Profiler’ has no member named ‘profile_data_monitor’ plugin.c:274: error: ‘Profiler’ has no member named ‘profile_data_monitor’ plugin.c:276: error: ‘Profiler’ has no member named ‘profile_data_monitor’ plugin.c:278: error: ‘Profiler’ has no member named ‘profile_data_monitor’ plugin.c:286: error: ‘Profiler’ has no member named ‘view_manager’ plugin.c: In function ‘on_profiler_select_target’: [...]
3 files containing menu definitions (old .ui now .xml) are missing in Maxim's patch in plugins valgrind, profile and indent. I have restored all of them.
I've reopened this bug because seems that anjuta still uses libglade libraries $ git grep "glade_xml_get" plugins/class-gen/window.c: button = glade_xml_get_widget (xml, button_id); plugins/class-gen/window.c: entry = glade_xml_get_widget (xml, entry_id); plugins/debug-manager/watch.c: dialog = glade_xml_get_widget (gxml, CHANGE_WATCH_DIALOG); plugins/debug-manager/watch.c: name_entry = glade_xml_get_widget (gxml, NAME_ENTRY); plugins/debug-manager/watch.c: value_entry = glade_xml_get_widget (gxml, VALUE_ENTRY); plugins/project-wizard/templates/anjuta-plugin/src/plugin.c: wid = glade_xml_get_widget (gxml, "top_widget"); plugins/project-wizard/templates/gtk/src/main.c: window = glade_xml_get_widget (gxml, "window"); liblgade code in plugins/class-gen/window.c and plugins/debug-manager/watch.c is on dead code, but plugins/project-wizard/templates/anjuta-plugin/src/plugin.c and plugins/project-wizard/templates/gtk/src/main.c is still used See http://www.gnome.org/~fpeters/299.html for more info
No libglade is really unused in Anjuta. The 2 living references are in files used in new project created by Anjuta not in Anjuta itself. Then, it would be nice to use GtkBuilder instead of libglade here too but it's less important. There is a new project kind to create a Gnome project containing mainly obsolete libraries too. I don't know how to avoid using bonobo for panel applet too.
Created attachment 138275 [details] [review] Migrate gtk wizard from libglade to GtkBuilder
Created attachment 138282 [details] [review] Migrate anjuta plugin wizard from libglade to GtkBuilder I've renamed older .ui files to .xml and .glade to .ui
Created attachment 138284 [details] [review] Migrate gtk wizard from libglade to GtkBuilder v2 The .ui files are in glade/ directory, not ui/
Created attachment 138285 [details] [review] Migrate gtkmm plugin wizard from libglade to GtkBuiler
Created attachment 138289 [details] [review] Migrate anjuta vala plugin wizard from libglade to GtkBuiler
Thanks for your patches. I have committed all of them with a few fixes. You need to use the .wiz file to copy the .ui file instead of the .glade file.
Just as addition, I think we should remove all Gnome* project wizard templates as they are completely obsolete. There are no (real) gnome libraries anymore and instead people should general purpose libraries.
(In reply to comment #30) > Just as addition, I think we should remove all Gnome* project wizard templates > as they are completely obsolete. There are no (real) gnome libraries anymore > and instead people should general purpose libraries. > I agree.
I think it's already done. The gnome project template has been removed quite some time ago. The gnome-applet project is, I think, still useful and doesn't use gnome library. I have committed a patch two weeks ago to use GtkBuilder instead of glade in gtk projects.