diff options
author | Bastien Nocera <hadess@hadess.net> | 2022-03-30 14:22:15 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2022-03-30 14:42:06 +0200 |
commit | 50ba6fa4252b239148767280ebe3cd1576913182 (patch) | |
tree | 3089f01965ebb2362abe801bb9da61c42f2e8518 | |
parent | d5b2ae499ef49a170fe23592ec812396ec1a815c (diff) | |
download | totem-50ba6fa4252b239148767280ebe3cd1576913182.tar.gz |
main: Remove totem_interface_load()
We use GResources now, which means no more UI files that fail to load.
-rw-r--r-- | docs/reference/totem-sections.txt | 1 | ||||
-rw-r--r-- | src/totem-interface.c | 97 | ||||
-rw-r--r-- | src/totem-interface.h | 4 |
3 files changed, 0 insertions, 102 deletions
diff --git a/docs/reference/totem-sections.txt b/docs/reference/totem-sections.txt index e29f745b8..d7d8546fc 100644 --- a/docs/reference/totem-sections.txt +++ b/docs/reference/totem-sections.txt @@ -101,7 +101,6 @@ totem_interface_create_header_button totem_interface_error totem_interface_error_blocking <SUBSECTION Private> -totem_interface_load </SECTION> <SECTION> diff --git a/src/totem-interface.c b/src/totem-interface.c index 32399d0b8..425196d4e 100644 --- a/src/totem-interface.c +++ b/src/totem-interface.c @@ -46,11 +46,6 @@ #include "totem-interface.h" -static GtkBuilder * -totem_interface_load_with_full_path (const char *filename, gboolean fatal, - GtkWindow *parent, gpointer user_data); -static char *totem_interface_get_full_path (const char *name); - static GtkWidget * totem_interface_error_dialog (const char *title, const char *reason, GtkWindow *parent) @@ -124,98 +119,6 @@ totem_interface_error_blocking (const char *title, const char *reason, } /** - * 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; -} - -/* - * totem_interface_load_with_full_path: - * @filename: the #GtkBuilder UI file path 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 from the given path 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 - */ -static GtkBuilder * -totem_interface_load_with_full_path (const char *filename, gboolean fatal, - GtkWindow *parent, gpointer user_data) -{ - GtkBuilder *builder = NULL; - GError *error = NULL; - - if (filename != NULL) { - builder = gtk_builder_new (); - gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE); - } - - if (builder == NULL || gtk_builder_add_from_file (builder, filename, &error) == FALSE) { - char *msg; - - msg = g_strdup_printf (_("Couldn’t load the “%s” interface. %s"), filename, error->message); - 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); - g_error_free (error); - - return NULL; - } - - gtk_builder_connect_signals (builder, user_data); - - return builder; -} - -static char * -totem_interface_get_full_path (const char *name) -{ - char *filename; - - filename = g_build_filename (DATADIR, - "totem", name, NULL); - - return filename; -} - -/** * totem_interface_create_header_button: * @header: The header widget to put the button in * @button: The button to use in the header diff --git a/src/totem-interface.h b/src/totem-interface.h index d209943c1..a41b0b210 100644 --- a/src/totem-interface.h +++ b/src/totem-interface.h @@ -28,10 +28,6 @@ G_BEGIN_DECLS -GtkBuilder *totem_interface_load (const char *name, - gboolean fatal, - GtkWindow *parent, - gpointer user_data); void totem_interface_error (const char *title, const char *reason, GtkWindow *parent); |