Skip to content

Commit 1e03846

Browse files
authored
Merge branch 'main' into leolost/recognizing-instead-with-gesture
2 parents 1ab719e + 2d3e9dd commit 1e03846

File tree

3 files changed

+13
-21
lines changed

3 files changed

+13
-21
lines changed

src/DBus.vala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class Gala.DBus {
1111
private static WindowManagerGala wm;
1212

1313
[DBus (visible = false)]
14-
public static void init (WindowManagerGala _wm) {
14+
public static void init (WindowManagerGala _wm, ScreenshotManager screenshot_manager) {
1515
wm = _wm;
1616

1717
Bus.own_name (BusType.SESSION, "org.pantheon.gala", BusNameOwnerFlags.NONE,
@@ -34,7 +34,7 @@ public class Gala.DBus {
3434
(connection) => {
3535
try {
3636
connection.register_object ("/org/gnome/Shell", DBusAccelerator.init (wm.get_display ()));
37-
connection.register_object ("/org/gnome/Shell/Screenshot", ScreenshotManager.init (wm));
37+
connection.register_object ("/org/gnome/Shell/Screenshot", screenshot_manager);
3838
} catch (Error e) { warning (e.message); }
3939
},
4040
() => {},

src/ScreenshotManager.vala

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//
22
// Copyright (C) 2016 Rico Tzschichholz, Santiago León O.
3+
// 2025 elementary, Inc.
34
//
45
// This program is free software: you can redistribute it and/or modify
56
// it under the terms of the GNU General Public License as published by
@@ -21,16 +22,6 @@ namespace Gala {
2122

2223
[DBus (name="org.gnome.Shell.Screenshot")]
2324
public class ScreenshotManager : Object {
24-
private static ScreenshotManager? instance;
25-
26-
[DBus (visible = false)]
27-
public static unowned ScreenshotManager init (WindowManager wm) {
28-
if (instance == null)
29-
instance = new ScreenshotManager (wm);
30-
31-
return instance;
32-
}
33-
3425
private WindowManager wm;
3526
private Settings desktop_settings;
3627

@@ -39,12 +30,13 @@ namespace Gala {
3930
private string prev_font_mono;
4031
private uint conceal_timeout;
4132

42-
construct {
43-
desktop_settings = new Settings ("org.gnome.desktop.interface");
33+
[DBus (visible = false)]
34+
public ScreenshotManager (WindowManager _wm) {
35+
wm = _wm;
4436
}
4537

46-
private ScreenshotManager (WindowManager _wm) {
47-
wm = _wm;
38+
construct {
39+
desktop_settings = new Settings ("org.gnome.desktop.interface");
4840
}
4941

5042
public void flash_area (int x, int y, int width, int height) throws DBusError, IOError {

src/WindowManager.vala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//
22
// Copyright (C) 2012-2014 Tom Beckmann, Rico Tzschichholz
3+
// 2025 elementary, Inc.
34
//
45
// This program is free software: you can redistribute it and/or modify
56
// it under the terms of the GNU General Public License as published by
@@ -71,6 +72,8 @@ namespace Gala {
7172

7273
public WindowTracker? window_tracker { get; private set; }
7374

75+
private ScreenshotManager screenshot_manager;
76+
7477
/**
7578
* Allow to zoom in/out the entire desktop.
7679
*/
@@ -187,7 +190,8 @@ namespace Gala {
187190
private void show_stage () {
188191
unowned Meta.Display display = get_display ();
189192

190-
DBus.init (this);
193+
screenshot_manager = new ScreenshotManager (this);
194+
DBus.init (this, screenshot_manager);
191195
DBusAccelerator.init (display);
192196
MediaFeedback.init ();
193197

@@ -2317,7 +2321,6 @@ namespace Gala {
23172321
string filename = clipboard ? "" : generate_screenshot_filename ();
23182322
bool success = false;
23192323
string filename_used = "";
2320-
unowned var screenshot_manager = ScreenshotManager.init (this);
23212324
yield screenshot_manager.screenshot_window (true, false, true, filename, out success, out filename_used);
23222325
} catch (Error e) {
23232326
// Ignore this error
@@ -2330,8 +2333,6 @@ namespace Gala {
23302333
bool success = false;
23312334
string filename_used = "";
23322335

2333-
unowned var screenshot_manager = ScreenshotManager.init (this);
2334-
23352336
int x, y, w, h;
23362337
yield screenshot_manager.select_area (out x, out y, out w, out h);
23372338
yield screenshot_manager.screenshot_area (x, y, w, h, true, filename, out success, out filename_used);
@@ -2345,7 +2346,6 @@ namespace Gala {
23452346
string filename = clipboard ? "" : generate_screenshot_filename ();
23462347
bool success = false;
23472348
string filename_used = "";
2348-
unowned var screenshot_manager = ScreenshotManager.init (this);
23492349
yield screenshot_manager.screenshot (false, true, filename, out success, out filename_used);
23502350
} catch (Error e) {
23512351
// Ignore this error

0 commit comments

Comments
 (0)