Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecation of set_theming #526

Open
ferdnyc opened this issue Sep 11, 2021 · 0 comments
Open

Deprecation of set_theming #526

ferdnyc opened this issue Sep 11, 2021 · 0 comments

Comments

@ferdnyc
Copy link

ferdnyc commented Sep 11, 2021

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 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:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant