elementary / elementary/granite

Deprecation of set_theming

Open
#526 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Vala
Stars
329
Forks
65
Avg merge
1d 14h
Merged PRs (30d)
31

Description

## Problem

`Utils.set_theming` was deprecated (in #404). The claim at the time was that it was basically-unused.

As @jeremypw pointed out at the time, there is additional use of that API in third-party apps, something [a github-wide search for `Granite.Widgets.Utils.set_theming`](https://github.com/search?q=%22Granite.Widgets.Utils.set_theming%22&type=Code) confirms.

The "replacement" field in the deprecation tagging was left blank, perhaps because of the aforementioned (presumed) minimal use of the API. The discussion in #404 makes the somewhat-cryptic suggestion, "[uses of this API] should probably be a gresourced style sheet instead as we've done in other apps".

The PR to actually replace the referenced instance (elementary/files#1376) is more enlightening, replacing a call to `Gtk.Widgets.Utils.set_theming` with the following:

```vala
var css_provider = new Gtk.CssProvider ();
try {
css_provider.load_from_data (".noradius-button { border-radius: 0; }");
style_context.add_provider (css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
} catch (Error e) {
critical ("Unable to style pathbar button: %s", e.message);
}
```

## Proposal

Set the deprecation tag `replacement` field for `set_theming` and related API deprecations to something like `"Gtk.CssProvider and Gtk.StyleContext.add_provider"`, to provide remaining callers with information on implementing a similar fix in their own code.

## Prior Art

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.