[gnome-software/gnome-3-14] shell details: Disconnect old signal handlers before setting new app
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/gnome-3-14] shell details: Disconnect old signal handlers before setting new app
- Date: Sun, 11 Oct 2015 12:08:00 +0000 (UTC)
commit 5df0dbd2387b53874237a95470c295b99e1edde9
Author: Rafal Luzynski <digitalfreak lingonborough com>
Date: Mon Sep 28 11:52:38 2015 +0200
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 | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index 129e4cf..bbe4513 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -938,8 +938,12 @@ gs_shell_details_filename_to_app_cb (GObject *source,
GsShellDetails *shell_details = GS_SHELL_DETAILS (user_data);
GsShellDetailsPrivate *priv = shell_details->priv;
- if (priv->app != NULL)
+ /* save app */
+ if (priv->app != NULL) {
+ g_signal_handlers_disconnect_by_func (priv->app, gs_shell_details_notify_state_changed_cb,
shell_details);
+ g_signal_handlers_disconnect_by_func (priv->app, gs_shell_details_progress_changed_cb,
shell_details);
g_object_unref (priv->app);
+ }
priv->app = gs_plugin_loader_filename_to_app_finish(plugin_loader,
res,
&error);
@@ -966,7 +970,6 @@ gs_shell_details_filename_to_app_cb (GObject *source,
return;
}
- /* save app */
g_signal_connect_object (priv->app, "notify::state",
G_CALLBACK (gs_shell_details_notify_state_changed_cb),
shell_details, 0);
@@ -976,6 +979,9 @@ gs_shell_details_filename_to_app_cb (GObject *source,
g_signal_connect_object (priv->app, "notify::licence",
G_CALLBACK (gs_shell_details_notify_state_changed_cb),
shell_details, 0);
+ g_signal_connect_object (priv->app, "notify::progress",
+ G_CALLBACK (gs_shell_details_progress_changed_cb),
+ shell_details, 0);
/* print what we've got */
tmp = gs_app_to_string (priv->app);
@@ -1053,8 +1059,11 @@ gs_shell_details_set_app (GsShellDetails *shell_details, GsApp *app)
gs_shell_details_set_state (shell_details, GS_SHELL_DETAILS_STATE_LOADING);
/* save app */
- if (priv->app != NULL)
+ if (priv->app != NULL) {
+ g_signal_handlers_disconnect_by_func (priv->app, gs_shell_details_notify_state_changed_cb,
shell_details);
+ g_signal_handlers_disconnect_by_func (priv->app, gs_shell_details_progress_changed_cb,
shell_details);
g_object_unref (priv->app);
+ }
priv->app = g_object_ref (app);
g_signal_connect_object (priv->app, "notify::state",
G_CALLBACK (gs_shell_details_notify_state_changed_cb),
@@ -1544,8 +1553,11 @@ gs_shell_details_finalize (GObject *object)
g_object_unref (priv->builder);
g_object_unref (priv->plugin_loader);
g_object_unref (priv->cancellable);
- if (priv->app != NULL)
+ if (priv->app != NULL) {
+ g_signal_handlers_disconnect_by_func (priv->app, gs_shell_details_notify_state_changed_cb,
shell_details);
+ g_signal_handlers_disconnect_by_func (priv->app, gs_shell_details_progress_changed_cb,
shell_details);
g_object_unref (priv->app);
+ }
if (priv->session != NULL)
g_object_unref (priv->session);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]