[totem/wip/hadess/interface-load: 3/6] main: Remove totem_interface_load()




commit 660f356f624e1ace4cc5adb241e3781a931305c4
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Mar 30 14:22:15 2022 +0200

    main: Remove totem_interface_load()
    
    We use GResources now, which means no more UI files that fail to load.

 docs/reference/totem-sections.txt |  1 -
 src/totem-interface.c             | 97 ---------------------------------------
 src/totem-interface.h             |  4 --
 3 files changed, 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)
@@ -123,98 +118,6 @@ totem_interface_error_blocking (const char *title, const char *reason,
        gtk_widget_destroy (error_dialog);
 }
 
-/**
- * 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
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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]