1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
public class Conversation {
private Gtk.Notebook conversations;
private Gtk.Widget widget;
private string jid;
private string display_name;
private class TabLabel : Gtk.HBox {
public TabLabel(string label) {
pack_start(new Gtk.Label(label), false, true, 0);
Gtk.Button closeButton = new Gtk.Button();
Gdk.Pixbuf closeImage = render_icon(Gtk.STOCK_CLOSE, (Gtk.IconSize)(-1), null);
//Gtk.Image closeImage = new Gtk.Image.from_stock(Gtk.STOCK_CLOSE, (Gtk.IconSize)4);
closeButton.image = new Gtk.Image.from_pixbuf(closeImage.scale_simple(16, 16, Gdk.InterpType.BILINEAR));
//closeButton.width_request = 20;
closeButton.height_request = 20;
pack_end(closeButton, false, false, 0);
show_all();
}
}
public Conversation(Gtk.Notebook conversations0, string jid0, string? display_name0) {
conversations = conversations0;
jid = jid0;
if(display_name0 != null)
display_name = display_name0;
else
display_name = jid;
Gtk.Builder builder = new Gtk.Builder();
try {
builder.add_objects_from_file("ephraim.glade", {"Conversation"});
} catch(Error e) {
}
widget = builder.get_object("Conversation") as Gtk.Widget;
unowned Gtk.Label title = builder.get_object("ConversationTitle") as Gtk.Label;
title.set_text("Conversation with " + display_name);
conversations.append_page(widget, new TabLabel(display_name));
}
~Conversation() {
conversations.remove(widget);
}
}
|