Skip to content

Commit

Permalink
Correctly use GtkApplication 'activate' signal, fix 'withdrawn' mode
Browse files Browse the repository at this point in the history
At startup, if the application was in 'withdrawn' mode, that is, wasn't
supposed to show up until the user clicks on the tray icon (if present),
the application used to block completely, due to a lack of Gdk locks in
the "activate" signal of the GtkApplication's handler: this signal comes
from the GApplication object, which isn't aware of the Gdk lock and
thus, doesn't hold it while running the handler, contrary to what's
happening during "normal" Gtk events.

Or that's what I understood.

Fix #57
  • Loading branch information
multani committed Jan 8, 2014
1 parent 78d38ed commit 6b9575b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG
Expand Up @@ -5,6 +5,8 @@ Bug fixes
'''''''''

* fix crashs on Gtk.TextView when updating the lyrics of a song
* fix withdrawn mode by fixing incorrect usage of threads and Gtk
eco-system


1.7a2 (2013-11-26)
Expand Down
3 changes: 2 additions & 1 deletion sonata/launcher.py
Expand Up @@ -164,6 +164,7 @@ class FakeModule:


def on_application_activate(application):
Gdk.threads_enter()
windows = application.get_windows()

if windows:
Expand All @@ -172,7 +173,7 @@ def on_application_activate(application):
else:
sonata = main.Base(args)
sonata.window.set_application(application)
sonata.window.show()
Gdk.threads_leave()

app = Gtk.Application(application_id="org.MPD.Sonata")
app.connect("activate", on_application_activate)
Expand Down

0 comments on commit 6b9575b

Please sign in to comment.