This repository has been archived by the owner on Jan 11, 2023. It is now read-only.
/
TelegramForm.vala
77 lines (64 loc) · 2.48 KB
/
TelegramForm.vala
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// This file is part of FeedReader.
//
// FeedReader is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// FeedReader is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with FeedReader. If not, see <http://www.gnu.org/licenses/>.
public class FeedReader.TelegramForm : ShareForm {
private Gtk.TextView m_textView;
public TelegramForm()
{
string tg_msg_text = _("Hey, check out this interesting article I used FeedReader to read");
var box = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 5);
m_textView = new Gtk.TextView();
m_textView.get_style_context().add_class("h3");
m_textView.set_wrap_mode(Gtk.WrapMode.WORD);
m_textView.buffer.text = tg_msg_text;
m_textView.border_width = 2;
var scrolled = new Gtk.ScrolledWindow(null, null);
scrolled.get_style_context().add_class(Gtk.STYLE_CLASS_FRAME);
scrolled.add(m_textView);
int margin = 5;
m_textView.left_margin = margin;
m_textView.right_margin = margin;
m_textView.top_margin = margin;
m_textView.bottom_margin = margin;
var button = new Gtk.Button.with_label(_("Send"));
button.halign = Gtk.Align.END;
button.get_style_context().add_class(Gtk.STYLE_CLASS_SUGGESTED_ACTION);
button.clicked.connect(() => { share(); });
var backButton = new Gtk.Button.from_icon_name("go-previous-symbolic");
backButton.set_focus_on_click(false);
backButton.set_relief(Gtk.ReliefStyle.NONE);
backButton.halign = Gtk.Align.START;
backButton.clicked.connect(() => {
goBack();
});
var headline = new Gtk.Label(_("Send Telegram"));
headline.get_style_context().add_class("h2");
headline.set_alignment(0.4f, 0.5f);
var box2 = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 0);
box2.pack_start(backButton, false, false, 0);
box2.pack_start(headline, true, true, 0);
this.pack_start(box2, false, false, 0);
this.pack_start(box, false, false);
this.pack_start(scrolled);
this.pack_end(button, false, false);
this.orientation = Gtk.Orientation.VERTICAL;
this.spacing = 5;
this.margin = 10;
this.show_all();
}
public string getMessage()
{
return m_textView.buffer.text;
}
}