Skip to content

Commit

Permalink
CloseDialog: Reuse the Gala.App object to get the user-visible title (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
tintou authored May 31, 2024
1 parent 5a166f8 commit d5e89a9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
18 changes: 5 additions & 13 deletions src/Dialogs.vala
Original file line number Diff line number Diff line change
Expand Up @@ -130,24 +130,16 @@ namespace Gala {
construct { parent = value; }
}

// this function isn't exported in glib.vapi
[CCode (cname = "g_locale_from_utf8")]
extern static string locale_from_utf8 (
string str,
ssize_t len = -1,
out size_t bytes_read = null,
out size_t bytes_wrriten = null,
out Error err = null
);

public CloseDialog (Meta.Window window) {
Object (window: window);
public App app { get; construct; }

public CloseDialog (Gala.App app, Meta.Window window) {
Object (app: app, window: window);
}

construct {
icon = "computer-fail";

var window_title = locale_from_utf8 (window.title) ?? window.get_sandboxed_app_id ();
var window_title = app.name;
if (window_title != null) {
title = _("%s” is not responding").printf (window_title);
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/WindowManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -2333,7 +2333,7 @@ namespace Gala {
}

public override Meta.CloseDialog? create_close_dialog (Meta.Window window) {
return new CloseDialog (window);
return new CloseDialog (window_tracker.get_app_for_window (window), window);
}

public override unowned Meta.PluginInfo? plugin_info () {
Expand Down

0 comments on commit d5e89a9

Please sign in to comment.