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

Change Granite.STYLE_CLASS_FOO to Granite.CssClass.FOO #741

Open
2 tasks
danirabbit opened this issue Dec 14, 2024 · 5 comments
Open
2 tasks

Change Granite.STYLE_CLASS_FOO to Granite.CssClass.FOO #741

danirabbit opened this issue Dec 14, 2024 · 5 comments
Labels
Bitesize Small, self-contained issue. Good for newcomers, and/or should be an easy fix. good first issue Should be solvable in a day or less by someone new

Comments

@danirabbit
Copy link
Member

Problem

We used to use these C style constant names to match GTK, but they were all removed from GTK so there’s no need to do that anymore

Proposal

  • Add either Granite.StyleClass.FOO or Granite.CssClass.Foo since these are used with Gtk.Widget.add_css_class ()
  • Mark Granite.STYLE_CLASS_FOO as deprecated

Prior Art (Optional)

No response

@danirabbit danirabbit added Bitesize Small, self-contained issue. Good for newcomers, and/or should be an easy fix. good first issue Should be solvable in a day or less by someone new labels Dec 14, 2024
@codecowboy
Copy link

This is marked as good first issue but doesn't detail where this change is needed (unless I am missing something). Is it in https://github.com/elementary/granite somewhere?

I'd like to contribute but the developer guide seems like it is only for App developers. Is there a guide somewhere for contributing to the OS? I am an ex developer but looking for a project to contribute to and elementaryos is something I use.

I would probably need some help getting an initial dev environment set up. Would someone be available to help with that? I am on the elementary community discord with the same username.

@davidmhewitt
Copy link
Member

davidmhewitt commented Dec 27, 2024

Yes, the code changes required to resolve this issue would be made in this repository. Generally, issues are reported against the GitHub repository where the relevant code lives. And if they're not, a developer will generally move them to the right place.

This issue is just about re-namespacing some of the constants in Granite. The existing constants live here:
https://github.com/elementary/granite/blob/main/lib/Constants.vala

So to resolve this issue, the high level steps would be:

  1. Clone this repository
  2. Create a new sub-namespace of Granite. There's an example of a nested namespace here:
    namespace SettingsUri {
  3. Copy all of the existing STYLE_CLASS_* constants into the new sub-namespace and rename them appropriately
  4. Mark the old constants as deprecated (example:
    [Version (deprecated = true, deprecated_since = "7.5.0", replacement = "Switchboard.SettingsSidebar")]
    )
  5. Update the Granite demo (https://github.com/elementary/granite/tree/main/demo) to use the constants from the new namespace
  6. Compile and test (more details below)
  7. Create a PR with the proposed changes

Compiling and testing

For each elementary repository on GitHub, the README will usually detail how to compile and install the code. So usually it's just a case of following those steps to build and test. Be aware that this will replace applications and libraries on your elementary OS system with the experimental version you just compiled. So, only do this on VMs or systems you don't mind experimenting with, or be prepared to recover your data if you break something 😅

Note that with some applications (namely the flatpak ones), it's possible to install multiple versions side by side and it's less risky. But as Granite is an underlying library, that's not the case here.

I was going to drop this detail in Discord but it feels better to put it here so it's a bit more permanent. Feel free to ping me on Discord if you need any more detail with anything here though!

@davidmhewitt
Copy link
Member

There's also some good general docs about contributing here:
https://docs.elementary.io/contributor-guide

@codecowboy
Copy link

@davidmhewitt Thanks. Can you assign this to me and I will make a start. If it becomes urgent for any reason please let me know - it will take me a while to get set up as I am still in the process of building a new linux box. For context, I am also new to Vala and any kind of GTK development.

@codecowboy
Copy link

With regret, I've decided to abandon using elementaryOS as it just wasn't stable or flexible enough to suit my needs; I encountered quite a few bugs and frustrations which I really wanted to try and work through. and even help fix, but sadly, I've reached my frustration limit. I wish you and the rest of the team all the best.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bitesize Small, self-contained issue. Good for newcomers, and/or should be an easy fix. good first issue Should be solvable in a day or less by someone new
Projects
None yet
Development

No branches or pull requests

3 participants