[GNC-dev] Widget naming and css

Robert Fewell 14ubobit at gmail.com
Sun Jun 24 16:06:20 EDT 2018


I'm OK with 'gnc-class-' and 'gnc-id-' and can make the changes on master
over time.
Could do it on maint but there may be some existing settings that need
changing to align.

Bob

On 24 June 2018 at 18:43, Geert Janssens <geert.gnucash at kobaltwit.be> wrote:

> Op zondag 24 juni 2018 18:12:19 CEST schreef John Ralls:
> > Bob,
> >
> > Thanks, much clearer.
> >
> > Using the prefix gnc-style and gnc-name does clarify the intent, so
> that’s
> > good.  My only concern from a grepping standpoint is that it mimics the
> > format for Scheme functions imported from C, but as long as we don’t have
> > any functions named gnc_style_foo and gnc_name_foo that’s probably OK.
> >
> > Regards,
> > John Ralls
> >
> Yes I'm fine with the concept too. On the other hand I like to think a bit
> more about the best prefixes to choose as they should be relevant for
> years to
> come.
>
> The primary reason to enumerate the style contexts and widget names used
> is to
> be able to write css rule based on them. Ideally/eventually this should
> even
> be possible for people understanding css but don't know the gtk internals
> very
> well. The reason I formulate it this way is that I think the prefixes
> should
> make most sense for css writers and are less important for code writers.
>
> So how will widget names and style contexts be used in css ?
> A style context maps to a css class. So the class is the core concept to
> stress and as such I would propose to use "gnc-class" as prefix for style
> contexts.
> A widget name maps to a css ID. In this case "ID" is the core concept to
> stress and hence to create  some consistency for our purpose I would
> propose
> to prefix them with "gnc-id".
>
> What do you think ?
>
> Regards,
>
> Geert
>
> > > On Jun 24, 2018, at 4:10 AM, Robert Fewell <14ubobit at gmail.com> wrote:
> > >
> > > Sorry it was not clear, so I will try again.
> > >
> > > When I was doing the GTK3 migration I added some context styles to
> various
> > > widgets but I now believe some of them should be widget names like the
> > > following... GncBusinessPage should really be a widget name and then
> with
> > > associated styles.
> > >
> > > So as an example I changed GncBusinessPage from a style context to a
> > > widget name of 'gnc-name-business-page' and associated style contexts
> to
> > > start with 'gnc-style-' along with some other changes I can now grep
> > > them...
> > >
> > > grep -nHIirF 'gnc-style-'
> > > gnucash/gnome/gnc-plugin-page-owner-tree.c:658:        style_label =
> > > "gnc-style-unknown"; gnucash/gnome/gnc-plugin-page-owner-tree.c:663:
>
> > >   style_label = "gnc-style-customer";
> > > gnucash/gnome/gnc-plugin-page-owner-tree.c:668:        style_label =
> > > "gnc-style-job"; gnucash/gnome/gnc-plugin-page-owner-tree.c:673:
>
> > > style_label = "gnc-style-vendor";
> > > gnucash/gnome/gnc-plugin-page-owner-tree.c:678:        style_label =
> > > "gnc-style-employee"; gnucash/gtkbuilder/dialog-vendor.glade:559:
>
> > >          <class name="gnc-style-vendor"/>
> > > gnucash/gtkbuilder/dialog-vendor.glade:796:                  <class
> > > name="gnc-style-vendor"/> gnucash/gtkbuilder/dialog-vendor.glade:830:
>
> > >  <class name="gnc-style-vendor"/>
> > >
> > > grep -nHIirF 'gnc-name-'
> > > gnucash/gnome/gnc-plugin-page-owner-tree.c:626:    gtk_widget_set_name
> > > (GTK_WIDGET(priv->widget), "gnc-name-business-page");
> > > gnucash/gnome/window-reconcile.c:1817:        gtk_widget_set_name
> > > (debits_box, "gnc-name-reconcile-window-debits");
> > > gnucash/gnome/window-reconcile.c:1822:        gtk_widget_set_name
> > > (credits_box, "gnc-name-reconcile-window-credits");
> > > gnucash/gnome/window-reconcile.c:1855:            gtk_widget_set_name
> > > (frame, "gnc-name-reconcile-window-totals");
> > > gnucash/gtkbuilder/dialog-vendor.glade:30:    <property
> > > name="name">gnc-name-vendor-dialog</property>
> > >
> > > With the grep command it easily shows me what widgets have been named
> > > along with style contexts and so I can easily apply CSS to them and
> > > possibly reuse the style contexts else ware in the code..
> > >
> > > So the question was how to name them consistently, I have used the
> > > prefixes of 'gnc-name-' and 'gnc-style-' and find them easily for
> > > possible manipulation / publication in the future.
> > >
> > > Hope this is clearer.
> > >
> > > Regards,
> > > Bob
> > >
> > > On 23 June 2018 at 16:59, John Ralls <jralls at ceridwen.fremont.ca.us
> <mailto:jralls at ceridwen.fremont.ca.us>> wrote:
> > > > On Jun 23, 2018, at 4:18 AM, Robert Fewell <14ubobit at gmail.com
> > > > <mailto:14ubobit at gmail.com>> wrote:
> > > >
> > > > I have been thinking about naming some widgets and changing some of
> the
> > > > entries I added with css style classes and wondered if there has
> been a
> > > > convention decided.
> > > >
> > > > What I would like to see is a couple of unique prefixes so that one
> > > > could
> > > > do a grep on the top level directory and obtain all such entries and
> > > > maybe
> > > > manipulate into some sort of list that could be published some ware.
> > > >
> > > > Doing a quick content search shows 'gnc-style-' and 'gnc-name-' would
> > > > work
> > > > but open to suggestions.
> > > >
> > > > This would allow those users inclined to customise the appearance
> more
> > > > easily.
> > > > I would probably do this on master over time.
> > >
> > > Bob,
> > >
> > > I’m not sure I understand what you’re suggesting. Perhaps you could
> > > suggest a concrete example?
> > >
> > > Regards,
> > > John Ralls
> >
> > _______________________________________________
> > gnucash-devel mailing list
> > gnucash-devel at gnucash.org
> > https://lists.gnucash.org/mailman/listinfo/gnucash-devel
>
>
>
>
>


More information about the gnucash-devel mailing list