class password_dialog(Dialog):
    
    def __init__(self, parent, icon):
        Dialog.__init__(self, "GtkPacman Login", parent,
                               DIALOG_MODAL | DIALOG_DESTROY_WITH_PARENT,
                           (STOCK_OK, RESPONSE_ACCEPT, STOCK_CANCEL, RESPONSE_REJECT))
        self.set_icon(pixbuf_new_from_file(icon))
        self._setup_layout()
        
    def _setup_layout(self):
        self.password_entry = Entry()
        self.password_entry.set_visibility(False)
        self.password_entry.set_invisible_char('*')
        info_label = Label(' Enter root password ')
        
        self.hbox = HBox()
                
        self.vbox.pack_start(info_label)
        self.vbox.pack_start(self.password_entry)
        self.vbox.pack_start(self.hbox)        
        self.show_all()
        
    def show_warning(self):
        image = Image()
        image.set_from_stock(STOCK_STOP, ICON_SIZE_BUTTON)
        warning_label = Label(' Invalid Password! ')        
        self.hbox.pack_start(image, False, False, 10)
        self.hbox.pack_start(warning_label, False, False, 0)
        self.show_all()