Commit 8a70b969 authored by Debarshi Ray's avatar Debarshi Ray

application, thumbnailer: Remove redundant GResource registration

GResources in the form of C source files generated by
glib-compile-resources(1) without the --manual-register flag, are
automatically registered as long as the compiler supports constructor
and destructor functions. Given that there's no explicit desire to
support compilers without such support, codified by the lack of the
--manual-register flag, calling g_resources_register is redundant.

Such statically compiled and linked GResources are automatically added
as GStaticResources to a list internal to GIO by the generated
constructor function, and are lazily registered whenever their
contents are referred to by their global path or URI.

This is unlike standalone *.gresource bundles. Those are GVariant
database (or GVDB) files, which need to be explicitly registered with
g_resources_register after being loaded with g_resource_load, so that
their contents can be referred to by their global path or URI.

GNOME/gnome-photos!77
parent 2eca975d
Pipeline #38369 passed with stage
in 13 minutes and 51 seconds
......@@ -54,8 +54,6 @@
#include "photos-main-window.h"
#include "photos-properties-dialog.h"
#include "photos-query.h"
#include "photos-resources.h"
#include "photos-resources-gegl.h"
#include "photos-search-context.h"
#include "photos-search-controller.h"
#include "photos-search-match.h"
......@@ -81,8 +79,6 @@ struct _PhotosApplication
GHashTable *refresh_miner_ids;
GList *miners;
GList *miners_running;
GResource *resource;
GResource *resource_gegl;
GSettings *bg_settings;
GSettings *ss_settings;
GSimpleAction *blacks_exposure_action;
......@@ -2647,12 +2643,6 @@ photos_application_startup (GApplication *application)
self->bg_settings = g_settings_new (DESKTOP_BACKGROUND_SCHEMA);
self->ss_settings = g_settings_new (DESKTOP_SCREENSAVER_SCHEMA);
self->resource = photos_get_resource ();
g_resources_register (self->resource);
self->resource_gegl = photos_gegl_get_resource ();
g_resources_register (self->resource_gegl);
icon_theme = gtk_icon_theme_get_default ();
gtk_icon_theme_add_resource_path (icon_theme, "/org/gnome/Photos/icons");
......@@ -2952,18 +2942,6 @@ photos_application_dispose (GObject *object)
self->miners = NULL;
}
if (self->resource != NULL)
{
g_resources_unregister (self->resource);
self->resource = NULL;
}
if (self->resource_gegl != NULL)
{
g_resources_unregister (self->resource_gegl);
self->resource_gegl = NULL;
}
g_clear_object (&self->create_window_cancellable);
g_clear_object (&self->bg_settings);
g_clear_object (&self->ss_settings);
......
......@@ -31,7 +31,6 @@
#include "photos-gegl.h"
#include "photos-pipeline.h"
#include "photos-pixbuf.h"
#include "photos-resources-gegl.h"
#include "photos-thumbnailer.h"
#include "photos-thumbnailer-dbus.h"
......@@ -41,7 +40,6 @@ struct _PhotosThumbnailer
GApplication parent_instance;
GDBusConnection *connection;
GHashTable *cancellables;
GResource *resource_gegl;
PhotosThumbnailerDBus *skeleton;
gchar *address;
};
......@@ -761,15 +759,9 @@ photos_thumbnailer_shutdown (GApplication *application)
static void
photos_thumbnailer_startup (GApplication *application)
{
PhotosThumbnailer *self = PHOTOS_THUMBNAILER (application);
G_APPLICATION_CLASS (photos_thumbnailer_parent_class)->startup (application);
photos_gegl_init ();
self->resource_gegl = photos_gegl_get_resource ();
g_resources_register (self->resource_gegl);
photos_debug (PHOTOS_DEBUG_THUMBNAILER, "Thumbnailer ready");
}
......@@ -783,7 +775,6 @@ photos_thumbnailer_dispose (GObject *object)
g_clear_object (&self->connection);
g_clear_pointer (&self->cancellables, g_hash_table_unref);
g_clear_pointer (&self->resource_gegl, g_resources_unregister);
G_OBJECT_CLASS (photos_thumbnailer_parent_class)->dispose (object);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment