diff options
author | Benjamin Otte <otte@redhat.com> | 2019-12-03 05:41:42 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2019-12-12 19:39:36 +0100 |
commit | 50157302122e873cfa1a43a7151249d0229c2066 (patch) | |
tree | 07ec8d27a57bcc13abdc464470bbf5b628d74bec /gtk/gtkbuilderparser.c | |
parent | f8a7f30a0dd1643376f942619603719333a8d6bf (diff) | |
download | gtk+-50157302122e873cfa1a43a7151249d0229c2066.tar.gz |
builder: Turn last dlsym() function into a scope API
Looking up a get_type function by its name is now also part of
GtkBuilderScope.
Diffstat (limited to 'gtk/gtkbuilderparser.c')
-rw-r--r-- | gtk/gtkbuilderparser.c | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/gtk/gtkbuilderparser.c b/gtk/gtkbuilderparser.c index 64e95fbfce..ff38c49405 100644 --- a/gtk/gtkbuilderparser.c +++ b/gtk/gtkbuilderparser.c @@ -18,17 +18,17 @@ #include "config.h" -#include <string.h> -#include <gmodule.h> - -#include <gio/gio.h> #include "gtkbuilderprivate.h" -#include "gtkbuilder.h" + #include "gtkbuildable.h" +#include "gtkbuilderscopeprivate.h" #include "gtkdebug.h" -#include "gtkversion.h" -#include "gtktypebuiltins.h" #include "gtkintl.h" +#include "gtktypebuiltins.h" +#include "gtkversion.h" + +#include <gio/gio.h> +#include <string.h> typedef struct { @@ -485,21 +485,6 @@ builder_construct (ParserData *data, return object; } -static GType -_get_type_by_symbol (const gchar *symbol) -{ - static GModule *module = NULL; - GTypeGetFunc func; - - if (!module) - module = g_module_open (NULL, 0); - - if (!g_module_symbol (module, symbol, (gpointer)&func)) - return G_TYPE_INVALID; - - return func (); -} - static void parse_requires (ParserData *data, const gchar *element_name, @@ -612,7 +597,7 @@ parse_object (GtkBuildableParseContext *context, /* Call the GType function, and return the GType, it's guaranteed afterwards * that g_type_from_name on the name will return our GType */ - object_type = _get_type_by_symbol (type_func); + object_type = gtk_builder_scope_get_type_from_function (gtk_builder_get_scope (data->builder), data->builder, type_func); if (object_type == G_TYPE_INVALID) { g_set_error (error, |