[gnome-photos/wip/rishi/redundant-resource-registration] application, thumbnailer: Remove redundant GResource registration



commit 4c0d163db86ace0c3c88fda4a39dbf4e874a1e7a
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Oct 23 19:32:13 2018 +0200

    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.
    
    https://gitlab.gnome.org/GNOME/gnome-photos/merge_requests/77

 src/photos-application.c | 22 ----------------------
 src/photos-thumbnailer.c |  9 ---------
 2 files changed, 31 deletions(-)
---
diff --git a/src/photos-application.c b/src/photos-application.c
index 03b67b5f..cbaece0a 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -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);
diff --git a/src/photos-thumbnailer.c b/src/photos-thumbnailer.c
index 3a347e0b..12c801d0 100644
--- a/src/photos-thumbnailer.c
+++ b/src/photos-thumbnailer.c
@@ -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);
 }


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