#!/usr/bin/env python

from gi.repository import Gtk

class InfoBar:
    def __init__(self):
        window = Gtk.Window()
        window.set_title("GTK3 infobar")
        vbox = Gtk.VBox(False, 5)
        hbox = Gtk.HBox(True, 5)

        label = Gtk.Label("Select a clip on the timeline to configure its associated effects")
        # Added stuff that was absent from the example
        label.set_line_wrap(True)

        self.infobar = Gtk.InfoBar()
        content = self.infobar.get_content_area()
        content.add(label)

        button_info = Gtk.Button("Info")
        button_warning = Gtk.Button("Warning")
        button_question = Gtk.Button("Question")
        button_error = Gtk.Button("Error")

        window.connect("destroy", lambda w: Gtk.main_quit())
        button_info.connect("clicked", self.infobar_type, Gtk.MessageType.INFO)
        button_warning.connect("clicked", self.infobar_type, Gtk.MessageType.WARNING)
        button_question.connect("clicked", self.infobar_type, Gtk.MessageType.QUESTION)
        button_error.connect("clicked", self.infobar_type, Gtk.MessageType.ERROR)
        self.infobar.connect("response", self.infobar_response)

        window.add(vbox)
        vbox.pack_start(self.infobar, True, True, 0)
        vbox.pack_start(hbox, False, False, 0)
        hbox.pack_start(button_info, True, True, 0)
#        hbox.pack_start(button_warning, True, True, 0)
#        hbox.pack_start(button_question, True, True, 0)
        hbox.pack_start(button_error, True, True, 0)
        
        window.show_all()

    def infobar_type(self, widget, type):
        self.infobar.set_message_type(type)
        self.infobar.show()

    def infobar_response(self, widget, event):
        self.infobar.hide()

InfoBar()
Gtk.main()
