[Github-comments] [geany/geany] Use GResource to load GtkBuilder XML UI file (#1703)

Colomban Wendling notifications at xxxxx
Sun Dec 3 00:59:35 UTC 2017


b4n commented on this pull request.



> @@ -2440,20 +2441,32 @@ void ui_init_builder(void)
 	gtk_builder_set_translation_domain(builder, GETTEXT_PACKAGE);
 
 	error = NULL;
-	interface_file = g_build_filename(app->datadir, "geany.glade", NULL);
-	if (! gtk_builder_add_from_file(builder, interface_file, &error))
+	ui_data = g_resource_lookup_data(geany_get_resource(),
+		"/org/geany/Geany/geany.glade", G_RESOURCE_LOOKUP_FLAGS_NONE, &error);

> Yeah. Alternatively we could just add a comment there saying to change the code when the needed version is minimum supported.

What I like with the gtkcompat thing is that we just have to drop the compat code when it's not needed anymore, we don't need to touch caller code.

> I think this specific (example) code is missing an `#else`

It's not, as it's replacing the GTK API with the `#define`, so the else if just the normal GTK 3.4 call.

> `gtk_build_add_from_string` call is not OK because of the undefined ordering of parameter evaluation in C (which is why I did it with two calls in the patch).

Good point

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/1703#discussion_r154511353
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20171203/d0be92f2/attachment.html>


More information about the Github-comments mailing list