Skip to content

Commit

Permalink
mark connections and binds deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
Aylur committed Jan 6, 2024
1 parent 9aac2aa commit dcb24f8
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 14 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
# Unreleased

## Features

- add: Overlay.overlay Box.child
- add: params to Utils.fetch

## Fixes

- notifications: warn on non 8 bits image

# 1.6.3

## Features

- feat: Service.bind and Variable.bind
- feat: AgsWidget.register
- export Widget.createCtor utility
Expand All @@ -12,11 +24,13 @@
- feat: PowerProfile Service

## Breaking Changes

- update: Hyprland.active.monitor to be an object

# 1.5.5

## Features

- feat: support print from client with --run-js
- feat: support shebang with --run-file
- add: Utils.monitorFile
Expand All @@ -29,6 +43,7 @@
# 1.5.4

## Features

- add: notificationForceTimeout option
- add: bluetooth device-added, device-removed signal
- add: cursor property
Expand All @@ -39,8 +54,10 @@
- add: --run-file

## Breaking Changes

- feat: Window.exclusivity
- deprecate: --run-promise cli flag

## Fixes

- overlay pass-through #168
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project('ags', 'c',
version: '1.6.3',
version: '1.6.4',
meson_version: '>= 0.62.0',
license: ['GPL-3.0-or-later'],
default_options: [ 'warning_level=2', 'werror=false', ],
Expand Down
4 changes: 2 additions & 2 deletions nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ let
in
stdenv.mkDerivation {
pname = "ags";
version = "1.6.3";
version = "1.6.4";

src = buildNpmPackage {
name = "ags";
src = ../.;

dontBuild = true;

npmDepsHash = "sha256-Uwikl4gvlSsQpuI/6WdkFrlfzspHixom7d4E66+1V7w=";
npmDepsHash = "sha256-3r9sdTsSsi5TP7UDdRFlZw94FeZpPz4HG22aeKzdmLQ=";

installPhase = ''
mkdir $out
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ags",
"version": "1.6.3",
"version": "1.6.4",
"description": "description",
"main": "src/main.ts",
"repository": "",
Expand Down
24 changes: 16 additions & 8 deletions src/widgets/widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ import { interval } from '../utils.js';
import { Variable } from '../variable.js';
import { App } from '../app.js';

let warned = false;
function deprecated() {
if (warned)
return;

console.warn(Error('Using "connections" and "binds" props are DEPRECATED\n' +
'Use .hook() .bind() .poll() .on() instead, refer to the wiki to see examples'));
warned = true;
}

const ALIGN = {
'fill': Gtk.Align.FILL,
'start': Gtk.Align.START,
Expand Down Expand Up @@ -54,14 +64,14 @@ export type Cursor =
| 'zoom-in'
| 'zoom-out'

export type Property = [prop: string, value: unknown];
type Property = [prop: string, value: unknown];

export type Connection<Self> =
type Connection<Self> =
| [GObject.Object, (self: Self, ...args: unknown[]) => unknown, string?]
| [string, (self: Self, ...args: unknown[]) => unknown]
| [number, (self: Self, ...args: unknown[]) => unknown];

export type Bind = [
type Bind = [
prop: string,
obj: GObject.Object,
objProp?: string,
Expand All @@ -78,11 +88,6 @@ export type BaseProps<Self extends Gtk.Widget, Props> = {
vpack?: Align
cursor?: Cursor
attribute?: any

// FIXME: deprecated
connections?: Connection<Self>[]
properties?: Property[]
binds?: Bind[],
}>

AgsWidget.register = register;
Expand Down Expand Up @@ -294,6 +299,7 @@ export default function AgsWidget<
if (!connections)
return;

deprecated();
connections.forEach(([s, callback, event]) => {
if (s === undefined || callback === undefined)
return console.error(Error('missing arguments to connections'));
Expand All @@ -318,6 +324,7 @@ export default function AgsWidget<
if (!binds)
return;

deprecated();
binds.forEach(([prop, obj, objProp = 'value', transform = out => out]) => {
// @ts-expect-error
this.bind(prop, obj, objProp, transform);
Expand All @@ -329,6 +336,7 @@ export default function AgsWidget<
if (!properties)
return;

console.warn(Error('"properties" is deprecated use "attribute" instead'));
properties.forEach(([key, value]) => {
(this as unknown as { [key: string]: unknown })[`_${key}`] = value;
});
Expand Down

0 comments on commit dcb24f8

Please sign in to comment.