Use GtkStyleContext within GtkBuilder ui files - css

How can I access a GtkWidget's StyleContext from within a GtkBuilder-.ui file? I know that, from Python for example, I could just use
SomeWidget.get_style_context().do_something()
How can I achieve this from a Builder file like this:
<object class="GtkSomeThing">
<property name="Foo">Bar</property>
</object>
I would ideally like to simply add some CSS to the widgets using the Builder file. That just seems so much cleaner than coding it in Python, as I would be able to keep all the stuff needed for the UI definition in one place.

Yes, and it's documented here under the "Gtk.Widget as Gtk.Buildable" heading. You can add
<style>
<class name="some-css-class"/>
</style>
to your <object> element.

Related

Move GhostDoc documentation to <include> tag file

So I have GhostDoc Pro and auto documented a project. Great.
The results are, as it says in the C# documentation put it all together verbose compared to the code. Therefore I would like to use the include tag and a separate file for the documentation to make my classes less documentation heavy.
All the classes are auto documented, but the documentation goes into class include files, like this:
/// <include file='MyMathClass.xml' path='docs/members[#name="math"]/Math/*'/>
... some code ...
and another class
/// <include file='MyArtClass.xml' path='docs/members[#name="art"]/Art/*'/>
... some code ...
Is there a feature to do this, or am I going to have to move every documentation tag by hand? I would like every class to have its own include file.
The feature is coming but the current version of GhostDoc doesn't support the

How can I easily override SEO Sulu CMS page extension in Symfony?

I want to override the SeoStructureExtension with my own implementation, which will support OpenGraph (OG) tags.
What is the easiest way to override it and add additional inputs?
I am afraid to say that overriding the SeoStructureExtension file can not be achieved very easily... The fields it saves are hardcoded. So the first thing you would have to do is override the sulu_page.extension.seo service, which references this class. I would say your best bet to achieve this, is to decorate this service.
The other part you have to extend is the XML file describing the page_seo form. Luckily this part is a little bit easier. Your Sulu installation should already come with a config/forms folder, where you can put a file similar to the original page_seo form. Give it the same key (page_seo) and only add the new fields you want to add (the name of the properties have to match what you are implementing in the decorated service). If you e.g. want to add a new text field, this file would look something like this:
<?xml version="1.0" ?>
<form xmlns="http://schemas.sulu.io/template/template"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.sulu.io/template/template http://schemas.sulu.io/template/form-1.0.xsd"
>
<key>page_seo</key>
<properties>
<property name="ext/seo/ogTitle" type="text_line">
<meta>
<title lang="en">OG Title</title>
</meta>
</property>
</properties>
</form>
Mind the ext/seo/ prefix before ogTitle, which is need for the information to be passed to the SeoStructureExtension.
I also think that these fields might make sense to be added to the core of Sulu. I would be happy if you create an issue, explaining what fields exactly you need etc. Then we can discuss if we implement it in the core as well, so that you don't have to add this manually in future versions.

How do I style a inc via html object with css?

I was searching for a way to use includes without server side assistance and found the object .inc method here.
Example: <object name="foo" type="text/html" data="foo.inc"/></object>
Which works great, except I can't style anything inside the .inc file without linking the style sheet within it.
Is there a way to do with the parent html file? like: object:foo #innerelement {}
That is my thinking anyways, like there should be some sort of notation for this.
If I recall correctly, the answer is no because this method is implemented similar to how an iframe tag would work.

How do I apply styling to my custom intro page?

I made my own welcome intro page using org.eclipse.ui.intro and I'm able to show my welcome extended with other contributors.
Now I'd like to decore my welcome with some css, and I have two question:
1) How can I apply predefined eclipse css (i.e Slate) to my page? I've already tried putting org.eclipse.ui.intro/INTRO_THEME = org.eclipse.ui.intro.universal.slate in plugin_customizazion.ini without success
2) there's a way to extend css to contributors without giving them the css file??? I mean there a way for contributors to use my own css if it is only inside my plugin (or eclipse plugin if i will be able to use "slate" style?)
Eclipse SDK Help
The only way to select a theme is via the preference org.eclipse.ui.intro/INTRO_THEME in plugin_customization.ini.
Theme-enabled intro implementation must make all the references to style and presentation resources using the $theme$ substitution variable. Absolute paths for images, pages, styles, etc. will be computed by resolving the substitution variable using the path of the currently active theme.
See Intro Content XML Format as well.
To answer the second question, if you define an intro theme which include your css file, other plugins will be able to use it for sure.
Cheers,
Max
Ok, now I've learned more about themes, but I think I have some problem with path.
I've defined my own theme, css and graphics, so I extend theme by configExtension. But when I load my application the welcome page doesn't load css neither images. I've also defined org.eclipse.ui.intro/INTRO_THEME in plugin_customization.ini.
I have a structure similar to slate template like this
my.plugin.name
|_resources
|_intro
|_graphics
|_html
in graphics there are all images definitions whlile in html there are css
then in intro I have my root.xhtml (referenced by intro.xml)
with this css reference
<link rel="stylesheet" href="$themes$/html/root-ie.css" type="text/css" charset="utf-8" />
finally I've defined configExtension with theme
<extension
point="org.eclipse.ui.intro.configExtension">
<theme
default="true"
id="my.plugin.name.themes.themename"
name="%theme.name.themenam"
path="/resources/intro"
scalable="true">
I think maybe the problem is with the path, I've also tried with path="resources/intro"
path="/resources/intro/" and path="resources/intro/" withous success
could someone post a simple but complete working sample please?

Richfaces+SEAM: good doc describing s:decorate tag functionality?

EDIT: Would it be more elegant to tweak the GUI using CSS, or some other way?
Is there any good documentation (the official one only shows a basic example) for this tag?
I want to use it like this:
<s:decorate template="template.xhtml">
....richfaces UI...
</s:decorate>
in order to format a list of question-answer pairs without using rich tables or nested panels.
I get the gist of what it does, but I don't understand exactly how I can edit my own template.xhtml files and make the UI look as I want by using it.
The s:decorate is basically the same as ui:decorate with some extra functionality like rendered
The ui:decorate can be explained as:
The UI Decorate tag is a templating
tag that decorates content included
from another Facelet. Any content
outside of the UI Decorate tag will be
displayed by the Facelets view
handler. Any content within the
decorate tag will be passed to the
associated template as parameters or
simply ignored. You can use nested
ui:define tags to pass named content
to the associated template. See
ui:insert for more information.
For more info you can read here and here
To answer your update question. You should also use CSS to style the content of your template

Resources