Method

GtkBuilderadd_from_file

Declaration [src]

gboolean
gtk_builder_add_from_file (
  GtkBuilder* builder,
  const char* filename,
  GError** error
)

Description [src]

Parses a file containing a UI definition and merges it with the current contents of builder.

This function is useful if you need to call gtk_builder_set_current_object()) to add user data to callbacks before loading GtkBuilder UI. Otherwise, you probably want gtk_builder_new_from_file() instead.

If an error occurs, 0 will be returned and error will be assigned a GError from the GTK_BUILDER_ERROR, G_MARKUP_ERROR or G_FILE_ERROR domains.

It’s not really reasonable to attempt to handle failures of this call. You should not use this function with untrusted files (ie: files that are not part of your application). Broken GtkBuilder files can easily crash your program, and it’s possible that memory was leaked leading up to the reported failure. The only reasonable thing to do when an error is detected is to call g_error().

Parameters

filename

Type: const char*

The name of the file to parse.

The data is owned by the caller of the method.
The value is a platform-native string, using the preferred OS encoding on Unix and UTF-8 on Windows.
error

Type: GError **

The return location for a recoverable error.

The argument can be NULL.
If the return location is not NULL, then you must initialize it to a NULL GError*.
The argument will be left initialized to NULL by the method if there are no errors.
In case of error, the argument will be set to a newly allocated GError; the caller will take ownership of the data, and be responsible for freeing it.

Return value

Type: gboolean

TRUE on success, FALSE if an error occurred.