[gnome-photos] application: Instantiate SearchProvider only when registering on D-Bus
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] application: Instantiate SearchProvider only when registering on D-Bus
- Date: Mon, 12 Jun 2017 21:56:32 +0000 (UTC)
commit 72af1debe9a6e8d13a755a4cb12db71167e99e82
Author: Debarshi Ray <debarshir gnome org>
Date: Thu Jun 8 14:45:25 2017 +0200
application: Instantiate SearchProvider only when registering on D-Bus
Now that the --version flag was implemented using the
handle_local_options virtual method, it is possible that the
Application may exit without ever touching D-Bus. So it is a tad
wasteful to instantiate the SearchProvider when it is never going to
be used. Since we are unreffing it in dbus_unregister, we might as well
create it in dbus_register.
This improves upon the fix in commit 8cfafad535ef83a0.
src/photos-application.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/src/photos-application.c b/src/photos-application.c
index 481ff15..b503653 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -1604,6 +1604,16 @@ photos_application_dbus_register (GApplication *application,
error))
goto out;
+ self->search_provider = photos_search_provider_new ();
+ g_signal_connect_swapped (self->search_provider,
+ "activate-result",
+ G_CALLBACK (photos_application_activate_result),
+ self);
+ g_signal_connect_swapped (self->search_provider,
+ "launch-search",
+ G_CALLBACK (photos_application_launch_search),
+ self);
+
search_provider_path = g_strconcat (object_path, PHOTOS_SEARCH_PROVIDER_PATH_SUFFIX, NULL);
if (!photos_search_provider_dbus_export (self->search_provider, connection, search_provider_path, error))
{
@@ -2059,16 +2069,6 @@ photos_application_init (PhotosApplication *self)
{
photos_utils_ensure_builtins ();
- self->search_provider = photos_search_provider_new ();
- g_signal_connect_swapped (self->search_provider,
- "activate-result",
- G_CALLBACK (photos_application_activate_result),
- self);
- g_signal_connect_swapped (self->search_provider,
- "launch-search",
- G_CALLBACK (photos_application_launch_search),
- self);
-
self->state = photos_search_context_state_new (PHOTOS_SEARCH_CONTEXT (self));
self->activation_timestamp = GDK_CURRENT_TIME;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]