Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Application : Gtk.Window {
- private GtkClutter.Embed embed;
- public Application () {
- //---------------------
- // COMPILE WITH: valac --pkg clutter-gtk-1.0 --pkg gtk+-3.0 test.vala
- //---------------------
- // Problem: I want to see the dark background from the Gtk window through the loaded icon
- //---------------------
- //Use dark theme!
- Gtk.Settings.get_default().gtk_application_prefer_dark_theme = true;
- this.window_position = Gtk.WindowPosition.CENTER;
- this.set_default_size (350, 70);
- this.destroy.connect (() => {
- Gtk.main_quit ();
- });
- embed = new GtkClutter.Embed ();
- var stage = embed.get_stage () as Clutter.Stage;
- var color = Clutter.Color().init(255,0,0,100);
- //stage.background_color = color;
- //stage.layout_manager = new Clutter.BinLayout();
- Gtk.IconTheme theme = Gtk.IconTheme.get_default();
- Gdk.Pixbuf? pixbuf = theme.load_icon_for_scale("media-optical-cd-audio", 128, 1, 0);
- Clutter.Image image = new Clutter.Image();
- image.set_data(pixbuf.get_pixels(),
- pixbuf.has_alpha ? Cogl.PixelFormat.RGBA_8888 : Cogl.PixelFormat.RGB_888,
- pixbuf.width, pixbuf.height, pixbuf.rowstride);
- var actor = new Clutter.Actor();
- actor.content = image;
- actor.set_size(pixbuf.width, pixbuf.height);
- stage.add_child(actor);
- stage.opacity = 122;
- embed.opacity = 0.5;
- embed.halign = Gtk.Align.START;
- embed.valign = Gtk.Align.START;
- embed.width_request = 100;
- embed.height_request = 100;
- this.add(embed);
- stdout.printf("BG %s\n", stage.background_color_set?"Ja" : "NEIN");
- }
- public static int main (string[] args) {
- Gtk.init (ref args);
- GtkClutter.init (ref args);
- Application app = new Application ();
- app.show_all ();
- Gtk.main ();
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement