|author||Vincent Sanders <firstname.lastname@example.org>||2015-06-13 11:31:23 +0100|
|committer||Vincent Sanders <email@example.com>||2015-06-17 21:35:40 +0100|
Change GTK UI builder handling to use resource API
GTK UI builder resources have till now been exclusively stored on disc requiring netsurf to ship numerous additional resource files. This requires going to disc every time a UI action is performed which can become a lot of unwanted file handling. GLib/GTK has moved towards GResource handling for such resources instead. It now seems that migrating to this style of usage is expected and indeed the only portable way to include pixbufs. This introduces an API to hide the various implementation details of how resources are handled from the rest of the codebase.
Diffstat (limited to 'gtk/compat.h')
1 files changed, 25 insertions, 0 deletions
diff --git a/gtk/compat.h b/gtk/compat.h
index 088cd79fe..9554b0cba 100644
@@ -268,4 +268,29 @@ GtkWidget *nsgtk_image_menu_item_new_with_mnemonic(const gchar *label);
void nsgtk_image_menu_item_set_image(GtkWidget *image_menu_item, GtkWidget *image);
+ * Parses a resource file containing a GtkBuilder UI definition and
+ * merges it with the current contents of builder.
+ * Compatability interface as this did not exist prior to GTK 3.4
+ * GTK prior to 3.4 can have the resources in a GResource but
+ * gtk_builder cannot directly instantiate from them
+ * GTK 3.4 onwards can use gtk_builder_add_from_resource() to add
+ * directly from resources. The gtk_builder_new_ type operations
+ * cannot be used because they are only available post 3.10 and handle
+ * all errors by aborting the application
+ * @note prior to GLIB 2.32 resources did not exist and this wrapper
+ * returns the error code.
+ * \param builder a GtkBuilder
+ * \param resource_path the path of the resource file to parse
+ * \param error return location for an error, or NULL.
+ * \return A positive value on success, 0 if an error occurred.
+guint nsgtk_builder_add_from_resource(GtkBuilder *builder, const gchar *resource_path, GError **error);
#endif /* NETSURF_GTK_COMPAT_H */