initialize `background-image` with a resource file

Master via gtkmm-list <[email protected]> Tue, 23 Aug 2022 22:14:07 +0430
Newsgroups gmane.comp.gnome.gtkmm
Message-ID <CALot762XMCtwK8NxoS=txrMYgRugh5BqBYa1ia5-DUzDdTbyow@mail.gmail.com>
--===============2103906559571835970==
Content-Type: multipart/alternative; boundary="00000000000029d47a05e6ec1d75"

--00000000000029d47a05e6ec1d75
Content-Type: text/plain; charset="UTF-8"

in my gtkmm app i have a label that has a background image thanks to css
provider. like this:
```
MainWindow::MainWindow():
Mylabel(Hello)
{
provider = Gtk::CssProvider::create();
provider->load_from_data(
"#LogoLabel{"
//"color:#800000;"
//"color:#5485ae;"
"color:#0075ff;"
"}"
"#PleaseHitKeyLbl{"
"background-color:#3333337a;"
"font-size:20px;"
"}"
"#BackgroundImage{"
"background-image:url(\"file:///home/ali/Desktop/sonbg.jpg\");"
"background-size:100% 100%;"
"opacity:0.3;"
"}"
);
MyLabel.set_name("BackgroundImage");
MyLabel.get_style_context()->add_provider(provider, 1);
}
```
The problem is that I dont know how to tell the `background-image` inside
the style provider to "get the image from resource" instead of "file"
please help me.
Regards.

--00000000000029d47a05e6ec1d75
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"rtl">in my gtkmm app i have a label that has a background image=
 thanks to css provider. like this:<br>```<br>MainWindow::MainWindow():<br>=
Mylabel(Hello)<br>{<br>provider =3D Gtk::CssProvider::create();<br>provider=
-&gt;load_from_data(<br>&quot;#LogoLabel{&quot;<br>//&quot;color:#800000;&q=
uot;<br>//&quot;color:#5485ae;&quot;<br>&quot;color:#0075ff;&quot;<br>&quot=
;}&quot;<br>&quot;#PleaseHitKeyLbl{&quot;<br>&quot;background-color:#333333=
7a;&quot;<br>&quot;font-size:20px;&quot;<br>&quot;}&quot;<br>&quot;#Backgro=
undImage{&quot;<br>&quot;background-image:url(\&quot;file:///home/ali/Deskt=
op/sonbg.jpg\&quot;);&quot;<br>&quot;background-size:100% 100%;&quot;<br>&q=
uot;opacity:0.3;&quot;<br>&quot;}&quot;<br>);<br>MyLabel.set_name(&quot;Bac=
kgroundImage&quot;);<br>MyLabel.get_style_context()-&gt;add_provider(provid=
er, 1);<br>}<br>```<div dir=3D"ltr">The problem is that I dont know how to =
tell the `background-image` inside the style provider to &quot;get the imag=
e from resource&quot; instead of &quot;file&quot; please help me.=C2=A0</di=
v><div dir=3D"ltr">Regards.</div></div>

--00000000000029d47a05e6ec1d75--

--===============2103906559571835970==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
gtkmm-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gtkmm-list

--===============2103906559571835970==--