granite icon indicating copy to clipboard operation
granite copied to clipboard

Change Granite.STYLE_CLASS_FOO to Granite.CssClass.FOO

Open danirabbit opened this issue 1 year ago • 5 comments

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

  • [x] Add either Granite.StyleClass.FOO or Granite.CssClass.Foo since these are used with Gtk.Widget.add_css_class ()

Mark Deprecated:

  • [x] STYLE_CLASS_ACCENT

  • [x] STYLE_CLASS_BACK_BUTTON

  • [x] STYLE_CLASS_CARD

  • [x] STYLE_CLASS_CHECKERBOARD

  • [x] STYLE_CLASS_DESTRUCTIVE_ACTION

  • [x] STYLE_CLASS_DIALOG_CONTENT_AREA

  • [x] STYLE_CLASS_H1_LABEL

  • [x] STYLE_CLASS_H2_LABEL

  • [x] STYLE_CLASS_H3_LABEL

  • [x] STYLE_CLASS_H4_LABEL

  • [x] STYLE_CLASS_SUCCESS

  • [x] STYLE_CLASS_TITLE_LABEL

  • [x] STYLE_CLASS_LINKED

  • [x] STYLE_CLASS_DIM_LABEL

  • [x] STYLE_CLASS_ERROR

  • [x] STYLE_CLASS_MESSAGE_DIALOG

  • [x] STYLE_CLASS_RICH_LIST

  • [x] STYLE_CLASS_SUGGESTED_ACTION

  • [x] STYLE_CLASS_WARNING

  • [x] STYLE_CLASS_CIRCULAR

  • [x] STYLE_CLASS_SMALL_LABEL

  • [x] STYLE_CLASS_MODE_SWITCH

  • [x] STYLE_CLASS_WARMTH

  • [x] STYLE_CLASS_TEMPERATURE

  • [ ] STYLE_CLASS_BACKGROUND

  • [ ] STYLE_CLASS_BADGE

  • [ ] STYLE_CLASS_COLOR_BUTTON

  • [ ] STYLE_CLASS_DEFAULT_DECORATION

  • [x] STYLE_CLASS_FRAME

  • [x] STYLE_CLASS_KEYCAP

  • [ ] STYLE_CLASS_LARGE_ICONS

  • [ ] STYLE_CLASS_OSD

  • [x] STYLE_CLASS_ROUNDED

  • [ ] STYLE_CLASS_SIDEBAR

  • [ ] STYLE_CLASS_TERMINAL

  • [x] STYLE_CLASS_MENU

  • [x] STYLE_CLASS_MENUITEM

  • [ ] STYLE_CLASS_FLAT

  • [ ] STYLE_CLASS_VIEW

Prior Art (Optional)

No response

danirabbit avatar Dec 14 '24 22:12 danirabbit

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.

codecowboy avatar Dec 27 '24 14:12 codecowboy

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: https://github.com/elementary/granite/blob/72120f9d6c1812fef6adfcbcdc9a06a02ba22732/lib/Constants.vala#L196
  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: https://github.com/elementary/granite/blob/72120f9d6c1812fef6adfcbcdc9a06a02ba22732/lib/Widgets/SettingsSidebar.vala#L13)
  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 :sweat_smile:

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 avatar Dec 27 '24 14:12 davidmhewitt

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

davidmhewitt avatar Dec 27 '24 14:12 davidmhewitt

@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 avatar Dec 29 '24 09:12 codecowboy

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.

codecowboy avatar Jan 14 '25 15:01 codecowboy