[gnome-software/wip/temp/ubuntu-xenial-rebased-corrected: 148/331] Only quit if we're not running as a GApplication service
- From: William Hua <williamhua src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/temp/ubuntu-xenial-rebased-corrected: 148/331] Only quit if we're not running as a GApplication service
- Date: Wed, 4 May 2016 14:10:58 +0000 (UTC)
commit f589aa2eafd1e1b543652d6dd6753ee2cd651bee
Author: William Hua <william hua canonical com>
Date: Tue Mar 8 16:06:44 2016 -0500
Only quit if we're not running as a GApplication service
We were destroying the window explicitly even when the application was
running as a service, causing subsequent activations to crash since the
window was already destroyed.
See also
https://bugs.launchpad.net/ubuntu/+source/gnome-software/+bug/1552150.
src/gs-shell.c | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-shell.c b/src/gs-shell.c
index c6528e5..3be3a15 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -623,6 +623,13 @@ main_window_closed_cb (GtkWidget *dialog, GdkEvent *event, gpointer user_data)
return TRUE;
}
+static void
+main_window_destroyed_cb (GtkWidget *widget,
+ GsShell *shell)
+{
+ g_action_group_activate_action (G_ACTION_GROUP (g_application_get_default ()), "quit", NULL);
+}
+
/**
* gs_shell_updates_changed_cb:
*/
@@ -698,6 +705,7 @@ void
gs_shell_setup (GsShell *shell, GsPluginLoader *plugin_loader, GCancellable *cancellable)
{
GsShellPrivate *priv = gs_shell_get_instance_private (shell);
+ GApplicationFlags flags;
GtkWidget *widget;
g_return_if_fail (GS_IS_SHELL (shell));
@@ -719,8 +727,15 @@ gs_shell_setup (GsShell *shell, GsPluginLoader *plugin_loader, GCancellable *can
gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
GS_DATA G_DIR_SEPARATOR_S "icons");
- g_signal_connect (priv->main_window, "delete-event",
- G_CALLBACK (main_window_closed_cb), shell);
+ flags = g_application_get_flags (g_application_get_default ());
+
+ if (flags & G_APPLICATION_IS_SERVICE) {
+ g_signal_connect (priv->main_window, "delete-event",
+ G_CALLBACK (main_window_closed_cb), shell);
+ } else {
+ g_signal_connect (priv->main_window, "destroy",
+ G_CALLBACK (main_window_destroyed_cb), shell);
+ }
/* fix up the header bar */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "header"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]