~pantheon-friends-dev/pantheon-friends/elementaryio_account

« back to all changes in this revision

Viewing changes to src/Widget/request_box.vala

  • Committer: Goncalo Margalho
  • Date: 2013-09-16 14:37:45 UTC
  • Revision ID: g@margalho.info-20130916143745-1umhm0qb73i0dtix
Initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***
 
2
 BEGIN LICENSE
 
3
 
 
4
 Copyright (C) 2013 Friends Developers
 
5
 This program is free software: you can redistribute it and/or modify it
 
6
 under the terms of the GNU Lesser General Public License version 3, as
 
7
 published    by the Free Software Foundation.
 
8
 
 
9
 This program is distributed in the hope that it will be useful, but
 
10
 WITHOUT ANY WARRANTY; without even the implied warranties of
 
11
 MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
 
12
 PURPOSE.  See the GNU General Public License for more details.
 
13
 
 
14
 You should have received a copy of the GNU General Public License along
 
15
 with this program.  If not, see <http://www.gnu.org/licenses>
 
16
 
 
17
 END LICENSE
 
18
***/
 
19
 
 
20
public class Friends.Widget.RequestBox : Gtk.Box {
 
21
    public Gtk.Button accept_button;
 
22
 
 
23
        public RequestBox (TelepathyGLib.Contact contact) {
 
24
                this.margin_top = 10;
 
25
        this.margin_bottom = 10;
 
26
        this.margin_right = 10;
 
27
        this.margin_left = 10;
 
28
 
 
29
        var avatar = Friends.Lib.TelepathyManager.load_image (contact);
 
30
        avatar.margin_right = 5;
 
31
        this.pack_start (avatar, false, true);
 
32
 
 
33
        var central_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
 
34
        var central_hbox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
 
35
        var central_hbox2 = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
 
36
        var name2 = new Gtk.Label (contact.alias);
 
37
        name2.margin_left = 10;
 
38
        name2.set_markup("<b>" + contact.alias + "</b>");
 
39
        name2.ellipsize = Pango.EllipsizeMode.END;
 
40
        central_hbox.pack_start (name2,false,true);
 
41
        var kind = new Gtk.Label ("2 friends in common");
 
42
        
 
43
        var css = new Gtk.CssProvider ();
 
44
 
 
45
        try {
 
46
            css.load_from_data ("*{color: #666;}",-1);
 
47
        } catch (GLib.Error e) {
 
48
            critical("Error: %s\n", e.message);
 
49
        }
 
50
        kind.get_style_context ().add_provider (css,600);
 
51
        kind.margin_left = 5;
 
52
        kind.margin_right = 10;
 
53
        central_hbox.add (kind);
 
54
        
 
55
        central_box.pack_start (central_hbox, true, true);
 
56
        var text = new Gtk.Label ("Colorado");
 
57
        text.margin_left = 10;
 
58
        text.ellipsize = Pango.EllipsizeMode.END;
 
59
        central_hbox2.pack_start (text,false,true);
 
60
        central_box.add (central_hbox2);
 
61
        this.pack_start (central_box,false,true);
 
62
        
 
63
        var hbox_status = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
 
64
        hbox_status.margin_top = 5;
 
65
        hbox_status.margin_bottom = 5;
 
66
        var delete_button = new Gtk.Button ();
 
67
        delete_button.add (new Gtk.Image.from_icon_name ("edit-delete-symbolic", Gtk.IconSize.SMALL_TOOLBAR));
 
68
        delete_button.margin_right = 10;
 
69
 
 
70
        accept_button = new Gtk.Button();
 
71
        accept_button.add (new Gtk.Image.from_icon_name ("contact-new-symbolic", Gtk.IconSize.BUTTON));
 
72
 
 
73
        hbox_status.add (delete_button);
 
74
        hbox_status.add (accept_button);
 
75
        
 
76
        this.pack_end (hbox_status, false, true);
 
77
 
 
78
        }
 
79
 
 
80
}
 
 
b'\\ No newline at end of file'