Skip to content

Commit

Permalink
GLib.Timeout.Add is available as GLib.Functions.TimeoutAddFull() with…
Browse files Browse the repository at this point in the history
… gir.core
  • Loading branch information
cameronwhite committed Mar 14, 2023
1 parent ea2295d commit 3aac3c5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
4 changes: 1 addition & 3 deletions Pinta.Gui.Widgets/Dialogs/SimpleEffectDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -459,21 +459,19 @@ private static string MakeCaption (string name)

private void DelayedUpdate (TimeoutHandler handler)
{
#if false // TODO-GTK4
if (event_delay_timeout_id != 0) {
GLib.Source.Remove (event_delay_timeout_id);
if (handler != timeout_func)
timeout_func?.Invoke ();
}

timeout_func = handler;
event_delay_timeout_id = GLib.Timeout.Add (event_delay_millis, () => {
event_delay_timeout_id = GLib.Functions.TimeoutAddFull (0, event_delay_millis, (_) => {
event_delay_timeout_id = 0;
timeout_func.Invoke ();
timeout_func = null;
return false;
});
#endif
}
#endregion
}
Expand Down
10 changes: 4 additions & 6 deletions Pinta/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,8 @@ private static void ExceptionManager_UnhandledException (GLib.UnhandledException
/// </summary>
static void RegisterForAppleEvents ()
{
#if false // TODO-GTK4
MacInterop.ApplicationEvents.Quit += (sender, e) => {
GLib.Timeout.Add (10, delegate {
GLib.Functions.TimeoutAddFull (0, 10, delegate {
PintaCore.Actions.App.Exit.Activate ();
return false;
});
Expand All @@ -165,7 +164,7 @@ static void RegisterForAppleEvents ()

MacInterop.ApplicationEvents.Reopen += (sender, e) => {
var window = PintaCore.Chrome.MainWindow;
window.Deiconify ();
window.Unminimize ();
window.Hide ();
window.Show ();
window.Present ();
Expand All @@ -174,17 +173,16 @@ static void RegisterForAppleEvents ()

MacInterop.ApplicationEvents.OpenDocuments += (sender, e) => {
if (e.Documents != null) {
GLib.Timeout.Add (10, delegate {
GLib.Functions.TimeoutAddFull (0, 10, delegate {
foreach (string filename in e.Documents.Keys) {
System.Console.Error.WriteLine ("Opening: {0}", filename);
PintaCore.Workspace.OpenFile (Core.GtkExtensions.FileNewForCommandlineArg (filename));
PintaCore.Workspace.OpenFile (Gio.FileHelper.NewForCommandlineArg (filename));
}
return false;
});
}
e.Handled = true;
};
#endif
}
}
}

0 comments on commit 3aac3c5

Please sign in to comment.