Beispiel #1
0
/**
 * totem_interface_load:
 * @name: the #GtkBuilder UI file to load
 * @fatal: %TRUE if errors loading the file should be fatal, %FALSE otherwise
 * @parent: (allow-none): the parent window to use when displaying error dialogues, or %NULL
 * @user_data: (allow-none): the user data to pass to gtk_builder_connect_signals(), or %NULL
 *
 * Load a #GtkBuilder UI file with the given name and return the #GtkBuilder instance for it. If loading the file fails, an error dialogue is shown.
 *
 * Return value: (transfer full): the loaded #GtkBuilder object, or %NULL
 */
GtkBuilder *
totem_interface_load (const char *name, gboolean fatal, GtkWindow *parent, gpointer user_data)
{
	GtkBuilder *builder = NULL;
	char *filename;

	filename = totem_interface_get_full_path (name);
	if (filename == NULL) {
		char *msg;

		msg = g_strdup_printf (_("Couldn't load the '%s' interface. %s"), name, _("The file does not exist."));
		if (fatal == FALSE)
			totem_interface_error (msg, _("Make sure that Totem is properly installed."), parent);
		else
			totem_interface_error_blocking (msg, _("Make sure that Totem is properly installed."), parent);

		g_free (msg);
		return NULL;
	}

	builder = totem_interface_load_with_full_path (filename, fatal, parent,
						       user_data);
	g_free (filename);

	return builder;
}
static GtkBuilder *
load_interface (const char *pname, const char *name,
		gboolean fatal, GtkWindow *parent,
		gpointer user_data)
{
	GtkBuilder *builder = NULL;
	char *filename;

	filename = find_file (pname, name);
	builder = totem_interface_load_with_full_path (filename, fatal, parent,
						       user_data);
	g_free (filename);

	return builder;
}