gnome-software/0001-shell-details-Disconnect-old-signal-handlers-before-.patch
2015-10-07 14:58:06 +02:00

83 lines
3.1 KiB
Diff

From 381ed8efca0139a14bd1f220b6e9a432663d335e Mon Sep 17 00:00:00 2001
From: Rafal Luzynski <digitalfreak@lingonborough.com>
Date: Mon, 28 Sep 2015 11:52:38 +0200
Subject: [PATCH] shell details: Disconnect old signal handlers before setting
new app
While at this, also make sure to connect to notify::progress not only
when installing from repos, but when installing local rpms as well.
https://bugzilla.gnome.org/show_bug.cgi?id=755664
---
src/gs-shell-details.c | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index 477a949..57c79b0 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -911,8 +911,12 @@ gs_shell_details_filename_to_app_cb (GObject *source,
g_autoptr(GError) error = NULL;
g_autofree gchar *tmp = NULL;
- if (self->app != NULL)
+ /* save app */
+ if (self->app != NULL) {
+ g_signal_handlers_disconnect_by_func (self->app, gs_shell_details_notify_state_changed_cb, self);
+ g_signal_handlers_disconnect_by_func (self->app, gs_shell_details_progress_changed_cb, self);
g_object_unref (self->app);
+ }
self->app = gs_plugin_loader_filename_to_app_finish(plugin_loader,
res,
&error);
@@ -938,7 +942,6 @@ gs_shell_details_filename_to_app_cb (GObject *source,
return;
}
- /* save app */
g_signal_connect_object (self->app, "notify::state",
G_CALLBACK (gs_shell_details_notify_state_changed_cb),
self, 0);
@@ -948,6 +951,9 @@ gs_shell_details_filename_to_app_cb (GObject *source,
g_signal_connect_object (self->app, "notify::licence",
G_CALLBACK (gs_shell_details_notify_state_changed_cb),
self, 0);
+ g_signal_connect_object (self->app, "notify::progress",
+ G_CALLBACK (gs_shell_details_progress_changed_cb),
+ self, 0);
/* print what we've got */
tmp = gs_app_to_string (self->app);
@@ -1019,8 +1025,11 @@ gs_shell_details_set_app (GsShellDetails *self, GsApp *app)
gs_shell_details_set_state (self, GS_SHELL_DETAILS_STATE_LOADING);
/* save app */
- if (self->app != NULL)
+ if (self->app != NULL) {
+ g_signal_handlers_disconnect_by_func (self->app, gs_shell_details_notify_state_changed_cb, self);
+ g_signal_handlers_disconnect_by_func (self->app, gs_shell_details_progress_changed_cb, self);
g_object_unref (self->app);
+ }
self->app = g_object_ref (app);
g_signal_connect_object (self->app, "notify::state",
G_CALLBACK (gs_shell_details_notify_state_changed_cb),
@@ -1271,10 +1280,14 @@ gs_shell_details_dispose (GObject *object)
{
GsShellDetails *self = GS_SHELL_DETAILS (object);
+ if (self->app != NULL) {
+ g_signal_handlers_disconnect_by_func (self->app, gs_shell_details_notify_state_changed_cb, self);
+ g_signal_handlers_disconnect_by_func (self->app, gs_shell_details_progress_changed_cb, self);
+ g_clear_object (&self->app);
+ }
g_clear_object (&self->builder);
g_clear_object (&self->plugin_loader);
g_clear_object (&self->cancellable);
- g_clear_object (&self->app);
g_clear_object (&self->session);
G_OBJECT_CLASS (gs_shell_details_parent_class)->dispose (object);
--
2.5.0