Dialogs: Fix Mutter bindings around dialog creation (#1941)

This commit is contained in:
Corentin Noël 2024-05-30 23:36:57 +02:00 committed by GitHub
parent 107dc080e2
commit 48511d7dd0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 11 additions and 19 deletions

View File

@ -130,8 +130,6 @@ namespace Gala {
construct { parent = value; } construct { parent = value; }
} }
public static Gee.Set<CloseDialog> open_dialogs = new Gee.HashSet<CloseDialog> ();
// this function isn't exported in glib.vapi // this function isn't exported in glib.vapi
[CCode (cname = "g_locale_from_utf8")] [CCode (cname = "g_locale_from_utf8")]
extern static string locale_from_utf8 ( extern static string locale_from_utf8 (
@ -146,10 +144,6 @@ namespace Gala {
Object (window: window); Object (window: window);
} }
~CloseDialog () {
open_dialogs.remove (this);
}
construct { construct {
icon = "computer-fail"; icon = "computer-fail";
@ -163,8 +157,6 @@ namespace Gala {
body = _("You may choose to wait a short while for the application to continue, or force it to quit entirely."); body = _("You may choose to wait a short while for the application to continue, or force it to quit entirely.");
accept_label = _("Force Quit"); accept_label = _("Force Quit");
deny_label = _("Wait"); deny_label = _("Wait");
open_dialogs.add (this);
} }
public override void show () { public override void show () {

View File

@ -2332,15 +2332,8 @@ namespace Gala {
dialog.show (); dialog.show ();
} }
public override unowned Meta.CloseDialog create_close_dialog (Meta.Window window) { public override Meta.CloseDialog? create_close_dialog (Meta.Window window) {
var new_dialog = CloseDialog.open_dialogs.first_match ((d) => d.window == window); return new CloseDialog (window);
if (new_dialog == null) {
new_dialog = new CloseDialog (window);
}
unowned var dialog = new_dialog;
return dialog;
} }
public override unowned Meta.PluginInfo? plugin_info () { public override unowned Meta.PluginInfo? plugin_info () {

View File

@ -168,6 +168,9 @@ unsigned_long_hash.v type="ulong?"
warning parent="Meta.Util" cheader_filename="meta/util.h" warning parent="Meta.Util" cheader_filename="meta/util.h"
create_context parent="Meta.Context" name="new" symbol_type="constructor" cheader_filename="meta/meta-context.h" create_context parent="Meta.Context" name="new" symbol_type="constructor" cheader_filename="meta/meta-context.h"
Plugin.create_close_dialog unowned=false nullable
Plugin.create_inhibit_shortcuts_dialog unowned=false
BackgroundActor sealed BackgroundActor sealed
BackgroundContent sealed BackgroundContent sealed
BackgroundImage sealed BackgroundImage sealed

View File

@ -690,9 +690,9 @@ namespace Meta {
[NoWrapper] [NoWrapper]
public virtual void confirm_display_change (); public virtual void confirm_display_change ();
[NoWrapper] [NoWrapper]
public virtual unowned Meta.CloseDialog create_close_dialog (Meta.Window window); public virtual Meta.CloseDialog? create_close_dialog (Meta.Window window);
[NoWrapper] [NoWrapper]
public virtual unowned Meta.InhibitShortcutsDialog create_inhibit_shortcuts_dialog (Meta.Window window); public virtual Meta.InhibitShortcutsDialog create_inhibit_shortcuts_dialog (Meta.Window window);
[NoWrapper] [NoWrapper]
public virtual void destroy (Meta.WindowActor actor); public virtual void destroy (Meta.WindowActor actor);
public void destroy_completed (Meta.WindowActor actor); public void destroy_completed (Meta.WindowActor actor);

View File

@ -328,6 +328,7 @@ if mutter46_dep.found()
'--pkg=gio-2.0', '--pkg=gio-2.0',
'--pkg=cairo', '--pkg=cairo',
'--pkg=graphene-gobject-1.0', '--pkg=graphene-gobject-1.0',
'--pkg=x11',
vapigen_args, vapigen_args,
files('Cogl-14-custom.vala') files('Cogl-14-custom.vala')
], ],
@ -345,6 +346,7 @@ if mutter46_dep.found()
'--pkg=pangocairo', '--pkg=pangocairo',
'--pkg=gio-2.0', '--pkg=gio-2.0',
'--pkg=glib-2.0', '--pkg=glib-2.0',
'--pkg=x11',
vapigen_args vapigen_args
], ],
depends: [mtk_target, cogl_target], depends: [mtk_target, cogl_target],
@ -364,6 +366,7 @@ if mutter46_dep.found()
'--pkg=gio-2.0', '--pkg=gio-2.0',
'--pkg=json-glib-1.0', '--pkg=json-glib-1.0',
'--pkg=pangocairo', '--pkg=pangocairo',
'--pkg=x11',
vapigen_args, vapigen_args,
files('Clutter-14-custom.vala') files('Clutter-14-custom.vala')
], ],

View File

@ -2,3 +2,4 @@ pango
glib-2.0 glib-2.0
gio-2.0 gio-2.0
mutter-mtk-14 mutter-mtk-14
x11