Skip to content

Commit

Permalink
Remove some deprecations and fix compile warnings (#1544)
Browse files Browse the repository at this point in the history
  • Loading branch information
lenemter committed Feb 21, 2023
1 parent d0abb9c commit 4e00b82
Show file tree
Hide file tree
Showing 14 changed files with 49 additions and 40 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -21,7 +21,7 @@ You'll need the following dependencies:
* libgtk-3-dev (>= 3.10.0)
* libmutter-10-dev (>= 42.0) | libmutter-dev (>= 3.18.3)
* libxml2-utils
* valac (>= 0.28.0)
* valac (>= 0.46.0)

Run `meson build` to configure the build environment. Change to the build directory and run `ninja` to build

Expand Down
8 changes: 4 additions & 4 deletions data/meson.build
Expand Up @@ -12,7 +12,7 @@ install_data(
i18n.merge_file(
input: 'gala.appdata.xml.in',
output: meson.project_name() + '.appdata.xml',
po_dir: join_paths(meson.source_root(), 'po'),
po_dir: join_paths(meson.global_source_root(), 'po'),
type: 'xml',
install: true,
install_dir: join_paths(get_option('datadir'), 'metainfo'),
Expand All @@ -21,7 +21,7 @@ i18n.merge_file(
i18n.merge_file(
input: 'gala-multitaskingview.desktop.in',
output: 'gala-multitaskingview.desktop',
po_dir: join_paths(meson.source_root (), 'po'),
po_dir: join_paths(meson.global_source_root (), 'po'),
type: 'desktop',
install: true,
install_dir: join_paths(data_dir, 'applications')
Expand All @@ -30,7 +30,7 @@ i18n.merge_file(
i18n.merge_file(
input: 'gala-other.desktop.in',
output: 'gala-other.desktop',
po_dir: join_paths(meson.source_root (), 'po'),
po_dir: join_paths(meson.global_source_root (), 'po'),
type: 'desktop',
install: true,
install_dir: join_paths(data_dir, 'applications')
Expand All @@ -42,7 +42,7 @@ if get_option('systemd')
dep_systemd = dependency('systemd', required: true)
systemd_userunitdir = get_option('systemduserunitdir')
if systemd_userunitdir == ''
systemd_userunitdir = dep_systemd.get_pkgconfig_variable('systemduserunitdir', define_variable: ['prefix', get_option('prefix')])
systemd_userunitdir = dep_systemd.get_variable('systemduserunitdir', pkgconfig_define: ['prefix', get_option('prefix')])
endif

bindir = join_paths(get_option('prefix'), get_option('bindir'))
Expand Down
2 changes: 1 addition & 1 deletion docs/meson.build
Expand Up @@ -23,7 +23,7 @@ basic_command = [
'--pkg', 'config',
vala_flags,
'--vapidir=' + join_paths(meson.build_root(), 'lib'),
'--vapidir=' + join_paths(meson.source_root(), 'vapi'),
'--vapidir=' + join_paths(meson.global_source_root(), 'vapi'),
'--doclet=html',
'--use-svg-images'
]
Expand Down
2 changes: 2 additions & 0 deletions lib/DragDropAction.vala
Expand Up @@ -366,6 +366,8 @@ namespace Gala {
return true;
}

break;
default:
break;
}

Expand Down
6 changes: 3 additions & 3 deletions lib/Utils.vala
Expand Up @@ -151,7 +151,7 @@ namespace Gala {
// Construct a new "application-default-icon" and store it in the cache
try {
var icon = Gtk.IconTheme.get_default ().load_icon_for_scale ("application-default-icon", icon_size, scale, 0);
unknown_icon_cache.add (new CachedIcon () { icon = icon, icon_size = icon_size, scale = scale });
unknown_icon_cache.add (CachedIcon () { icon = icon, icon_size = icon_size, scale = scale });
return icon;
} catch (Error e) {
var icon = new Gdk.Pixbuf (Gdk.Colorspace.RGB, true, 8, icon_size * scale, icon_size * scale);
Expand Down Expand Up @@ -227,7 +227,7 @@ namespace Gala {

try {
var pixbuf = icon_info.load_icon ();
icon_cache.@set (desktop, new CachedIcon () { icon = pixbuf, icon_size = icon_size, scale = scale });
icon_cache.@set (desktop, CachedIcon () { icon = pixbuf, icon_size = icon_size, scale = scale });
return pixbuf;
} catch (Error e) {
return null;
Expand All @@ -237,7 +237,7 @@ namespace Gala {
var size_with_scale = icon_size * scale;
try {
var pixbuf = new Gdk.Pixbuf.from_stream_at_scale (file.read (), size_with_scale, size_with_scale, true);
icon_cache.@set (desktop, new CachedIcon () { icon = pixbuf, icon_size = icon_size, scale = scale });
icon_cache.@set (desktop, CachedIcon () { icon = pixbuf, icon_size = icon_size, scale = scale });
return pixbuf;
} catch (Error e) {
return null;
Expand Down
4 changes: 2 additions & 2 deletions lib/meson.build
Expand Up @@ -16,8 +16,8 @@ gala_lib_sources = files(

gala_resources = gnome.compile_resources(
'gala-resources',
join_paths(meson.source_root(), 'data', 'gala.gresource.xml'),
source_dir: join_paths(meson.source_root(), 'data'),
join_paths(meson.global_source_root(), 'data', 'gala.gresource.xml'),
source_dir: join_paths(meson.global_source_root(), 'data'),
c_name: 'gala',
)

Expand Down
6 changes: 3 additions & 3 deletions meson.build
@@ -1,7 +1,7 @@
project('gala',
'c', 'vala',
version: '7.0.0',
meson_version: '>= 0.50.0',
meson_version: '>= 0.58.0',
license: 'GPL3',
)

Expand All @@ -14,7 +14,7 @@ cc = meson.get_compiler('c')

gala_version = meson.project_version()

vala_version_required = '0.28.0'
vala_version_required = '0.46.0'
vala = meson.get_compiler('vala')
if not vala.version().version_compare('>= @0@'.format(vala_version_required))
error('Valac >= @0@ required!'.format(vala_version_required))
Expand Down Expand Up @@ -132,7 +132,7 @@ if mutter_dep.length() == 0
error ('No supported mutter library found!')
endif

mutter_typelib_dir = libmutter_dep.get_pkgconfig_variable('typelibdir')
mutter_typelib_dir = libmutter_dep.get_variable('typelibdir')

if get_option('systemd')
vala_flags += ['--define', 'WITH_SYSTEMD']
Expand Down
4 changes: 2 additions & 2 deletions src/AccentColor/AccentColorManager.vala
Expand Up @@ -146,12 +146,12 @@ public class Gala.AccentColorManager : Object {
path = Filename.from_uri (picture_uri);
metadata = new GExiv2.Metadata ();
metadata.open_path (path);

return metadata.try_get_tag_string (TAG_ACCENT_COLOR);
} catch (Error e) {
warning ("Error parsing exif metadata of \"%s\": %s", path, e.message);
return null;
}

return metadata.get_tag_string (TAG_ACCENT_COLOR);
}

private NamedColor? get_accent_color (ColorExtractor color_extractor) {
Expand Down
6 changes: 3 additions & 3 deletions src/Main.vala
Expand Up @@ -50,15 +50,15 @@ namespace Gala {
act.sa_mask = empty_mask;
act.sa_flags = 0;

if (Posix.sigaction (Posix.SIGPIPE, act, null) < 0) {
if (Posix.sigaction (Posix.Signal.PIPE, act, null) < 0) {
warning ("Failed to register SIGPIPE handler: %s", GLib.strerror (GLib.errno));
}

if (Posix.sigaction (Posix.SIGXFSZ, act, null) < 0) {
if (Posix.sigaction (Posix.Signal.XFSZ, act, null) < 0) {
warning ("Failed to register SIGXFSZ handler: %s", GLib.strerror (GLib.errno));
}

GLib.Unix.signal_add (Posix.SIGTERM, () => {
GLib.Unix.signal_add (Posix.Signal.TERM, () => {
ctx.terminate ();
return GLib.Source.REMOVE;
});
Expand Down
4 changes: 3 additions & 1 deletion src/PluginManager.vala
Expand Up @@ -86,7 +86,7 @@ namespace Gala {

private bool load_module (string plugin_name) {
var path = Module.build_path (plugin_dir.get_path (), plugin_name);
var module = Module.open (path, ModuleFlags.BIND_LOCAL);
var module = Module.open (path, ModuleFlags.LOCAL);
if (module == null) {
warning (Module.error ());
return false;
Expand Down Expand Up @@ -170,6 +170,8 @@ namespace Gala {
}
window_switcher_provider = name;
return true;
default:
break;
}

return true;
Expand Down
40 changes: 22 additions & 18 deletions src/ScreenshotManager.vala
Expand Up @@ -353,24 +353,28 @@ namespace Gala {
paint_flags |= Clutter.PaintFlag.FORCE_CURSORS;
}

if (GLib.ByteOrder.HOST == GLib.ByteOrder.LITTLE_ENDIAN) {
wm.stage.paint_to_buffer (
{x, y, width, height},
scale,
image.get_data (),
image.get_stride (),
Cogl.PixelFormat.BGRA_8888_PRE,
paint_flags
);
} else {
wm.stage.paint_to_buffer (
{x, y, width, height},
scale,
image.get_data (),
image.get_stride (),
Cogl.PixelFormat.ARGB_8888_PRE,
paint_flags
);
try {
if (GLib.ByteOrder.HOST == GLib.ByteOrder.LITTLE_ENDIAN) {
wm.stage.paint_to_buffer (
{x, y, width, height},
scale,
image.get_data (),
image.get_stride (),
Cogl.PixelFormat.BGRA_8888_PRE,
paint_flags
);
} else {
wm.stage.paint_to_buffer (
{x, y, width, height},
scale,
image.get_data (),
image.get_stride (),
Cogl.PixelFormat.ARGB_8888_PRE,
paint_flags
);
}
} catch (Error e) {
warning (e.message);
}
return image;
}
Expand Down
2 changes: 2 additions & 0 deletions src/Widgets/WindowCloneContainer.vala
Expand Up @@ -277,6 +277,8 @@ namespace Gala {
closest = (WindowClone) window;
}
break;
default:
break;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Widgets/WindowSwitcher.vala
Expand Up @@ -128,7 +128,7 @@ namespace Gala {
container.motion_event.connect (container_motion_event);

var rgba = InternalUtils.get_theme_accent_color ();
var accent_color = new Clutter.Color ();
var accent_color = Clutter.Color ();
accent_color.init (
(uint8) (rgba.red * 255),
(uint8) (rgba.green * 255),
Expand Down
1 change: 0 additions & 1 deletion src/WindowTracker.vala
Expand Up @@ -5,7 +5,6 @@
*/

public class Gala.WindowTracker : GLib.Object {
private Gala.App? focused_app = null;
private GLib.HashTable<unowned Meta.Window, Gala.App> window_to_app;

public signal void windows_changed ();
Expand Down

0 comments on commit 4e00b82

Please sign in to comment.