[GNC-dev] Widget naming and css
John Ralls
jralls at ceridwen.fremont.ca.us
Sun Jun 24 12:12:19 EDT 2018
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
> 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
>
>
More information about the gnucash-devel
mailing list