b4n commented on this pull request.

Overall, why not.

> @@ -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);
+       if (ui_data == NULL)

what about combining this with the check below with a `||`, as the body is 
almost totally the same (but for the `ui_data` unrefing part)

> @@ -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);

Too bad we can't use 
[`gtk_builder_add_from_resource()`](https://developer.gnome.org/gtk3/stable/GtkBuilder.html#gtk-builder-add-from-resource)…
 maybe we should simply add compatibility for it on GTK < 3.4?

```c
#if !GTK_CHECK_VERSION(3, 4)
guint gtkcompat_builder_add_from_resource(GtkBuilder *builder, const gchar 
resource_path, GError **error)
{
    guint success = 0;
    GBytes *bytes = g_resources_lookup_data(resource_path, 
G_RESOURCE_LOOKUP_FLAGS_NONE, error);
    gsize bytes_size;

    if (bytes)
        success = gtk_builder_add_from_string(builder, g_bytes_get_data(bytes, 
&bytes_size), bytes_size, error);

    return success;
}
#define gtk_builder_add_from_resource gtkcompat_builder_add_from_resource
#endif
```

-- 
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#pullrequestreview-80687721

Reply via email to