~lubuntu-software-center-team/lubuntu-software-center/vala-port

« back to all changes in this revision

Viewing changes to src/Widgets/Pages/InfoMessage.vala

  • Committer: Stephen Smally
  • Date: 2012-03-04 12:59:13 UTC
  • Revision ID: eco.stefi@fastwebnet.it-20120304125913-bk1iutifwoeoyo0i
Worked a lot!

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//  Stephen Smally © 2012
 
2
//      This program is free software; you can redistribute it and/or modify
 
3
//      it under the terms of the GNU General Public License as published by
 
4
//      the Free Software Foundation; either version 2 of the License, or
 
5
//      (at your option) any later version.
 
6
//      
 
7
//      This program is distributed in the hope that it will be useful,
 
8
//      but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9
//      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
10
//      GNU General Public License for more details.
 
11
//      
 
12
//      You should have received a copy of the GNU General Public License
 
13
//      along with this program; if not, write to the Free Software
 
14
//      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
15
//      MA 02110-1301, USA.
 
16
//     
 
17
 
 
18
using Gtk;
 
19
 
 
20
namespace Lsc.Widgets {
 
21
    public class InfoMessage : InfoBar {
 
22
        // Signals
 
23
        public signal void choosed ();
 
24
        
 
25
        // Widgets
 
26
        public Label text;
 
27
        public Button info_button;
 
28
        public Button action_button;
 
29
        
 
30
        // Vars
 
31
        private Pk.Package pkg;
 
32
        
 
33
        public enum ResponseId {
 
34
            INFO,
 
35
            INSTALL
 
36
        }
 
37
        
 
38
        public void update (string pkg_name) {
 
39
            stdout.printf("%s\n", pkg_name);
 
40
            pkg.set_id(pkg_name);
 
41
            no_show_all = false;
 
42
            show_all();
 
43
            text.set_label(@"Selected package <b>$(pkg.get_name())</b>");
 
44
        }
 
45
        
 
46
        public InfoMessage () {
 
47
            message_type = MessageType.INFO;
 
48
            ((Box) get_action_area()).orientation = Orientation.HORIZONTAL;
 
49
            Box main = get_content_area() as Box;
 
50
            main.orientation = Orientation.HORIZONTAL;
 
51
            main.spacing = 2;
 
52
            orientation = Orientation.HORIZONTAL;
 
53
            
 
54
            text = new Label("");
 
55
            text.use_markup = true;
 
56
            text.ellipsize = Pango.EllipsizeMode.END;
 
57
            
 
58
            add_button(Stock.INFO, ResponseId.INFO);
 
59
            add_button("Install", ResponseId.INSTALL);
 
60
            
 
61
            focus_out_event.connect(() => {
 
62
                set_visible(false);
 
63
                return false;
 
64
            });
 
65
            
 
66
            main.pack_start(text, false, false, 0);
 
67
            no_show_all = true;
 
68
            
 
69
            pkg = new Pk.Package();
 
70
        }
 
71
    }
 
72
}
 
 
b'\\ No newline at end of file'