2
using System.Text.RegularExpressions;
4
5
using System.Threading;
5
6
using System.Diagnostics;
12
16
public partial class MainWindow: Gtk.Window
18
public static Window mainWindow;
15
21
GetTwitterData getTwitterData = new GetTwitterData();
16
22
PostToTwitter postToTwitter = new PostToTwitter();
17
CompositeInterface compositeInterface = new CompositeInterface();
18
ReadInfo readInfo = new ReadInfo();
23
//CompositeInterface compositeInterface = new CompositeInterface();
24
public static int navigation = 0;
25
public static ReadInfo readInfo = new ReadInfo();
20
28
PreferencesWindow preferencesWindow;
21
AboutDialog aboutDialog;
24
StatusIcon statusIcon = new StatusIcon();
29
AboutDialog aboutDialog;
33
StatusIcon statusIcon = new StatusIcon();
37
public UrlLabel urlLabel1 = new UrlLabel();
38
public IconEntry PostEntry = new IconEntry();
26
40
public string imageUrl = "";
27
public string screenName = "";
41
public static string screenName = "";
28
42
public string TwitterPostUrl = "http://twitter.com/statuses/update.xml";
29
43
public string TwitterFriendsUrl = "http://twitter.com/statuses/friends_timeline.xml";
30
44
public string TwitterPublicUrl = "http://twitter.com/statuses/public_timeline.xml";
45
public string TwitterDirectUrl = "http://twitter.com/direct_messages.xml";
33
48
public static GConf.Client client;
78
109
Title = "gTwitter " + MainClass.version;
110
vpaned1.Position = 84;
111
TopNotebook.Page = 0;
114
vbox2.Add(urlLabel1);
115
urlLabel1.LineWrap = true;
116
urlLabel1.Selectable = true;
117
urlLabel1.Xalign = 0.0f;
118
urlLabel1.Yalign = 0.0f;
119
urlLabel1.WidthRequest = 100;
120
urlLabel1.Markup = String.Format("<span foreground='darkblue'>{0}</span>",
121
Catalog.GetString ("Click on Preferences button to enter username and password"));
124
urlLabel1.UrlActivated += delegate(object o, UrlActivatedArgs args) {
125
Process.Start("gnome-open", args.Url);
129
hbox2.Add(PostEntry);
130
PostEntry.AddClearButton();
131
//PostEntry.SetIcon(IconEntryPosition.Primary, new Image(Stock.Network, IconSize.Menu));
132
PostEntry.Text = Catalog.GetString ("What are you doing?");
135
PostEntry.Activated += OnPostEntryActivated;
136
PostEntry.FocusInEvent += OnPostEntryFocusInEvent;
137
PostEntry.FocusOutEvent += OnPostEntryFocusOutEvent;
138
PostEntry.Changed += OnPostEntryChanged;
139
//PostEntry.IconPressed += delegate(object o, IconPressedArgs args) {
81
142
if (MainClass.composite) {
82
143
scrolledwindow1.BorderWidth = 10;
102
182
CellRendererText numbersCell = new CellRendererText();
103
183
numbersColumn.PackStart(numbersCell, true);
105
TreeViewColumn nameColumn = new TreeViewColumn();
185
imageColumn = new TreeViewColumn();
186
imageColumn.Title = "Image";
187
CellRendererPixbuf imageCell = new CellRendererPixbuf();
188
imageColumn.PackStart(imageCell, true);
190
nameColumn = new TreeViewColumn();
106
191
nameColumn.Title = "Name";
107
192
nameColumn.Expand = true;
108
193
CellRendererText nameCell = new CellRendererText();
194
nameCell.Yalign = 0.0f;
195
nameCell.WrapWidth = 260;
196
nameCell.WrapMode = Pango.WrapMode.WordChar;
197
nameColumn.Sizing = Gtk.TreeViewColumnSizing.Autosize;
109
198
nameColumn.PackStart (nameCell, true);
111
TreeViewColumn timeColumn = new TreeViewColumn();
200
timeColumn = new TreeViewColumn();
112
201
timeColumn.Title = "Time";
113
202
CellRendererText timeCell = new CellRendererText();
114
203
timeColumn.PackStart (timeCell, true);
116
205
Treeview1.AppendColumn(numbersColumn);
206
Treeview1.AppendColumn(imageColumn);
117
207
Treeview1.AppendColumn(nameColumn);
118
208
Treeview1.AppendColumn(timeColumn);
120
210
numbersColumn.AddAttribute (numbersCell, "text", 0);
121
nameColumn.AddAttribute (nameCell, "markup", 1);
122
timeColumn.AddAttribute (timeCell, "markup", 2);
211
imageColumn.AddAttribute (imageCell, "pixbuf", 1);
212
nameColumn.AddAttribute (nameCell, "markup", 2);
213
timeColumn.AddAttribute (timeCell, "markup", 3);
124
215
//create config and images directory
125
216
Gnome.Vfs.Vfs.Initialize();
128
219
//Directory.CreateDirectory(configDir);
129
220
//Directory.CreateDirectory(configDir + "images");
132
224
statusIcon.FromPixbuf = new Gdk.Pixbuf(null, "gtwitter-22.png");
133
225
statusIcon.Tooltip = String.Format("gTwitter {0}", MainClass.version);
134
226
statusIcon.Activate += StatusIconActivate;
135
227
statusIcon.PopupMenu += StatusIconPopupMenu;
229
PreferencesButton.Visible = false;
230
AboutButton.Visible = false;
231
QuitButton.Visible = false;
235
AboutButton.Clicked += new EventHandler(this.AboutDialogActivate);
137
236
//Viewport vp1 = (Viewport)scrolledwindow1.Child;
138
237
//vp1.ModifyBg(StateType.Normal , new Gdk.Color(61,120,183));
140
239
//PostEntry.GrabFocus();
141
240
Statusbar1.Push(0, "Connecting...");
243
aboutDialog = new AboutDialog(this);
244
preferencesWindow = new PreferencesWindow();
143
246
if ( passCheck.Length > 2 ) {
147
250
getDataThread.Start();
148
251
//timeout n seconds if it takes to much time, kill the thread
149
252
//GLib.Timeout.Add (40000, new GLib.TimeoutHandler (TooLong));
153
Statusbar1.Push(0, "You should enter username/password in Preferences.");
255
Statusbar1.Push(0, Catalog.GetString ("Enter username/password in Preferences."));
154
256
RefreshButton.Sensitive = true;
155
PostEntry.Sensitive = true;
257
//PostEntry.Sensitive = true;
258
menubar1.Sensitive = true;
259
preferencesWindow.Show();
158
262
ActivateRefresh();
160
264
Gnome.Vfs.Vfs.Shutdown();
162
aboutDialog = new AboutDialog(this);
165
267
//status icon click
166
268
void StatusIconActivate(object o, EventArgs e)
168
if (window1.Visible) {
270
if (mainWindow.Visible) {
170
if (window1.IsActive) {
171
window1.GetPosition(out x, out y);
272
if (mainWindow.IsActive) {
273
mainWindow.GetPosition(out x, out y);
277
mainWindow.Present();
280
mainWindow.Move(x, y);
283
//stop blinking the status icon
284
//statusIcon.Blinking = false;
182
287
void SHActivate(object o, EventArgs e)
184
if (window1.Visible) {
289
if (mainWindow.Visible) {
186
window1.GetPosition(out x, out y);
291
mainWindow.GetPosition(out x, out y);
295
mainWindow.Move(x, y);
194
299
//status icon menu
251
356
//treeview change event
252
357
protected virtual void OnTreeview1CursorChanged(object sender, System.EventArgs e)
254
imageThread = new Thread(new ThreadStart(ImageThreadRoutine));
256
//clear statusbar and image
259
UserImage.Stock = "gtk-missing-image";
260
UserImage.IconSize = 6;
263
TreeIter iter = new TreeIter();
265
GLib.Value val = new GLib.Value ();
266
Treeview1.Selection.GetSelected (out model, out iter);
267
liststore.GetValue (iter, 0, ref val);
268
string navigation = (string) val;
272
string text = readInfo.text[Int32.Parse(navigation) - 1];
273
UserName.Markup = "<span size='large' weight='bold'>" + readInfo.name[Int32.Parse(navigation) -1] + "</span>";
274
UserNLabel.Markup = "<span foreground='gray'>" + readInfo.screenName[Int32.Parse(navigation) -1] + "</span>";
275
UserText.Markup = "<span foreground='darkblue'>" + text + "</span>";
276
//UserText.Text = readInfo.text[Int32.Parse(navigation) - 1];
278
screenName = readInfo.screenName[Int32.Parse(navigation) -1];
281
UserImage.FromFile = (configDir+"images/"+screenName+".png");
361
if (!TweetView.Active) {
363
TopNotebook.Page = 0;
365
ScreenNameLabel.Text = "";
366
LocationLabel.Text = "";
367
DescriptionLabel.Text = "";
370
imageThread = new Thread(new ThreadStart(ImageThreadRoutine));
372
//clear statusbar and image
375
UserImage.Stock = "gtk-missing-image";
282
376
UserImage.IconSize = 6;
378
//TODO: Add the user image in the notification
379
//TODO: atach the notification to the statusIcon
382
TreeIter iter = new TreeIter();
384
GLib.Value val = new GLib.Value ();
385
Treeview1.Selection.GetSelected (out model, out iter);
386
liststore.GetValue (iter, 0, ref val);
387
string navigation1 = (string) val;
390
navigation = Int32.Parse(navigation1)-1;
391
} catch (ArgumentNullException) {}
395
if ((int) client.Get (SOURCE_KEY) != 2) {
397
string text = readInfo.text[navigation];
284
//if it doesn't exist fetch it
285
if (UserImage.Stock == "gtk-missing-image") {
287
Statusbar1.Push(0, "Fetching user image...");
288
imageUrl = readInfo.image[Int32.Parse(navigation) -1];
293
catch (ArgumentNullException) {
294
Statusbar1.Push(0, "No connection or wrong username/password.");
296
catch (NullReferenceException) {
400
text = UrlDetection(text);
402
UserName.Markup = "<span size='large' weight='bold'>" + readInfo.name[navigation] + "</span>";
403
UserNLabel.Markup = "<span foreground='gray'>" + readInfo.screenName[navigation] + "</span>";
406
text = text.Replace("&lt;", "<");
407
text = text.Replace("&gt;", ">");
408
urlLabel1.Markup = "<span foreground='darkblue'>" + text + "</span>";
410
screenName = readInfo.screenName[navigation];
413
UserImage.FromFile = (configDir+"images/"+screenName+".png");
414
UserImage.IconSize = 6;
417
if (mainWindow.Visible == false) {
418
if ((bool) client.Get (NOTIFY_KEY) == true)
420
if ((bool) client.Get (NOTIFY_PUBFRIE_KEY) == true || (bool) client.Get (NOTIFY_ALL_KEY) == true)
423
Notification notify = new Notification ();
424
notify.Summary = screenName;
426
notify.Icon = Gdk.Pixbuf.LoadFromResource ("gtwitter-48.png");
427
notify.Urgency = Urgency.Normal;
429
notify.Timeout = 4500;
431
//statusIcon.Blinking = true;
435
//if it doesn't exist fetch it
436
if (UserImage.Stock == "gtk-missing-image") {
438
Statusbar1.Push(0, Catalog.GetString ("Fetching user image..."));
439
imageUrl = readInfo.image[navigation];
446
string text = readInfo.direct_text[navigation];
449
text = UrlDetection(text);
451
UserName.Markup = String.Format("<span size='large' weight='bold'>{0}</span>",
452
Catalog.GetString ("Direct Messages"));
453
UserNLabel.Markup = "<span foreground='gray'>" + readInfo.direct_screenName[navigation] + "</span>";
454
urlLabel1.Markup = "<span foreground='darkblue'>" + text + "</span>";
455
//urlLabel1.Text = readInfo.text[Int32.Parse(navigation) - 1];
457
screenName = readInfo.direct_screenName[navigation];
460
UserImage.FromFile = (configDir+"images/"+screenName+".png");
461
UserImage.IconSize = 6;
464
if (mainWindow.Visible == false) {
465
if ((bool) client.Get (NOTIFY_DIRECT_KEY) == true)
467
Notification notify = new Notification ();
468
notify.Summary = "Direct Tweet from " + readInfo.direct_screenName[navigation];
469
notify.Summary = text;
470
notify.Icon = Gdk.Pixbuf.LoadFromResource ("gtwitter-48.png");
471
notify.Timeout = 4500;
473
//statusIcon.Blinking = true;
476
if ((bool) client.Get (NOTIFY_ALL_KEY) == true)
478
Notification notify = new Notification ();
479
notify.Summary = readInfo.direct_screenName[navigation];
480
notify.Summary = text;
481
notify.Icon = Gdk.Pixbuf.LoadFromResource ("gtwitter-48.png");
482
notify.Timeout = 4500;
484
//statusIcon.Blinking = true;
490
catch (ArgumentNullException) {
491
Statusbar1.Push(0, Catalog.GetString ("No connection or wrong username/password."));
493
catch (NullReferenceException) {
499
public static string UrlDetection(string text)
501
// match protocol://url
502
Regex httpRegex = new Regex(@"([a-z]+://[^)(,!\s]+)", RegexOptions.IgnoreCase);
504
Regex wwwRegex = new Regex(@"(?:^|\s)(www\.[^)(,!\s]+)", RegexOptions.IgnoreCase);
506
Regex atRegex = new Regex(@"@([^\s:,!]+)", RegexOptions.IgnoreCase);
508
text = httpRegex.Replace(text, "<a href=\"$1\">$1</a>");
509
text = atRegex.Replace(text, "@<a href=\"http://twitter.com/$1\">$1</a>");
510
text = wwwRegex.Replace(text, "<a href=\"http://$1\">$1</a>");
300
515
//preferences button
302
516
protected virtual void OnPreferencesButtonClicked(object sender, System.EventArgs e)
305
preferencesWindow = new PreferencesWindow();
309
518
preferencesWindow.Show();
430
642
//populate treeview
431
643
public void PopulateTreeviewThreadRoutine()
433
Gtk.Application.Invoke (delegate {
439
string si, name, time;
440
for (int i = 0; i < readInfo.statusCount; i++) {
442
si = (i+1).ToString();
443
name = String.Format("<span size='small'>{0}</span>", readInfo.name[i]);
444
time = String.Format("<span size='small'>{0}</span>", readInfo.relative_time[i]);
446
//Console.WriteLine(si + name + time);
447
liststore.AppendValues (si, name, time);
450
Treeview1.Model = liststore;
452
if (liststore != null)
453
Treeview1.SetCursor(TreePath.NewFirst(), null, false);
456
catch (NullReferenceException ex) {
457
if (MainClass.debug) {
458
Console.WriteLine("Treeview exception: PopulateTreeview()");
459
Console.WriteLine(ex.StackTrace);
463
RefreshButton.Sensitive = true;
464
PostEntry.Sensitive = true;
645
//TweetView not activated
646
if (!TweetView.Active) {
648
Gtk.Application.Invoke (delegate {
651
timeColumn.Visible = true;
652
imageColumn.Visible = false;
656
if ( (int) client.Get (SOURCE_KEY) != 2 ) {
657
string si, name, time;
658
for (int i = 0; i < readInfo.statusCount; i++) {
660
si = (i+1).ToString();
661
name = String.Format("<span size='small'>{0}</span>", readInfo.name[i]);
662
time = String.Format("<span size='small'>{0}</span>", readInfo.relative_time[i]);
664
//Console.WriteLine(si + name + time);
665
liststore.AppendValues (si,
673
string si, screen_name, time;
674
for (int i = 0; i < readInfo.direct_statusCount; i++) {
676
si = (i+1).ToString();
677
screen_name = String.Format("<span size='small'>{0}</span>", readInfo.direct_screenName[i]);
678
time = String.Format("<span size='small'>{0}</span>", readInfo.direct_relative_time[i]);
680
liststore.AppendValues (si,
687
Treeview1.Model = liststore;
689
if (liststore != null)
690
Treeview1.SetCursor(TreePath.NewFirst(), null, false);
693
catch (NullReferenceException ex) {
694
if (MainClass.debug) {
695
Console.WriteLine("Treeview exception: PopulateTreeview()");
696
Console.WriteLine(ex.StackTrace);
700
RefreshButton.Sensitive = true;
701
PostEntry.Sensitive = true;
702
menubar1.Sensitive = true;
705
//TweetView activated
708
Gtk.Application.Invoke (delegate {
711
imageColumn.Visible = true;
712
timeColumn.Visible = false;
716
if ( (int) client.Get (SOURCE_KEY) != 2 ) {
718
for (int i = 0; i < readInfo.statusCount; i++) {
720
si = (i+1).ToString();
722
text = String.Format("<b>{1}</b> <span size='small' foreground='gray'>({2})</span>\n<span size='small' foreground='darkblue'>{0}</span>",
723
readInfo.text[i], readInfo.name[i], readInfo.relative_time[i]);
725
String imageFile = (configDir+"images/"+readInfo.screenName[i]+".png");
730
uPixbuf = new Gdk.Pixbuf(imageFile);
732
catch (GLib.GException) {
734
imageUrl = readInfo.image[i];
736
uPixbuf = getTwitterData.GetUserImage(imageUrl);
738
//save friends image if it doesn't exist
739
if ((int) client.Get (SOURCE_KEY) == 0 && !System.IO.File.Exists(configDir + "images/" + readInfo.screenName[i] + ".png"))
740
uPixbuf.Save(configDir + "images/" + readInfo.screenName[i] + ".png", "png");
742
//uPixbuf = new Gdk.Pixbuf(null, "gtwitter-22.png");
746
liststore.AppendValues (si,
755
for (int i = 0; i < readInfo.direct_statusCount; i++) {
757
si = (i+1).ToString();
758
text = String.Format("<b>{1}</b> <span size='small' foreground='gray'>({2})</span>\n<span size='small' foreground='darkblue'>{0}</span>",
759
readInfo.direct_text[i], readInfo.direct_screenName[i], readInfo.direct_relative_time[i]);
761
liststore.AppendValues (si,
762
new Gdk.Pixbuf(null, "gtwitter-48.png"),
768
Treeview1.Model = liststore;
770
if (liststore != null)
771
Treeview1.SetCursor(TreePath.NewFirst(), null, false);
774
catch (NullReferenceException ex) {
775
if (MainClass.debug) {
776
Console.WriteLine("Treeview exception: PopulateTreeview()");
777
Console.WriteLine(ex.StackTrace);
781
RefreshButton.Sensitive = true;
782
PostEntry.Sensitive = true;
783
menubar1.Sensitive = true;
790
void Queue (string url)
794
req = (HttpWebRequest) WebRequest.Create (url);
795
req.KeepAlive = false;
797
WebResponse resp = null;
799
resp = req.GetResponse ();
800
req.BeginGetRequestStream (mycallback, this);
803
Stream s = resp.GetResponseStream ();
804
pix1 = new Gdk.Pixbuf (s);
811
void mycallback (IAsyncResult r)
813
req.EndGetRequestStream (r);
815
Gtk.Application.Invoke (delegate {
816
Console.WriteLine("sdddddddd");
470
823
//thread function to call GetTwitterData
523
878
Gtk.Application.Invoke (delegate {
524
Statusbar1.Push(0, "Connection failed! No internet connection.");
525
UserName.Markup = "<span size='large' weight='bold'>Connection failed!</span>";
879
Statusbar1.Push(0, Catalog.GetString ("Connection failed!"));
880
UserName.Markup = String.Format("<span size='large' weight='bold'>{0}</span>",
881
Catalog.GetString ("Connection failed!"));
526
882
RefreshButton.Sensitive = true;
527
PostEntry.Sensitive = true;
883
//PostEntry.Sensitive = true;
884
menubar1.Sensitive = true;
531
888
GLib.Timeout.Add (3000, new GLib.TimeoutHandler (ClearStatusbar));
891
if (sourceKey == 2) {
893
if ( getTwitterData.GetTwitterDirectData(TwitterDirectUrl, usernameKey, passKey, configDir) ) {
895
Gtk.Application.Invoke (delegate {
896
Statusbar1.Push(0, Catalog.GetString("Connection ok, populating with data."));
897
urlLabel1.Selectable = true;
901
readStoredData.Start();
904
Gtk.Application.Invoke (delegate {
905
Statusbar1.Push(0, Catalog.GetString("Connection failed!"));
906
UserName.Markup = String.Format("<span size='large' weight='bold'>{0}</span>",
907
Catalog.GetString("Connection failed!"));
908
RefreshButton.Sensitive = true;
909
//PostEntry.Sensitive = true;
910
menubar1.Sensitive = true;
914
GLib.Timeout.Add (3000, new GLib.TimeoutHandler (ClearStatusbar));
534
917
catch (NoSuchKeyException) {
536
919
Gtk.Application.Invoke (delegate {
537
Statusbar1.Push(0, "Connection failed! No connection or wrong username/password.");
538
UserName.Markup = "<span size='large' weight='bold'>Connection failed!</span>";
920
Statusbar1.Push(0, Catalog.GetString("Connection failed!"));
921
UserName.Markup = String.Format("<span size='large' weight='bold'>{0}</span>",
922
Catalog.GetString("Connection failed!"));
539
923
RefreshButton.Sensitive = true;
540
924
//PostEntry.Sensitive = true;
547
929
//clear statusbar timeout
671
1061
Gtk.Application.Invoke (delegate {
672
Statusbar1.Push(0, "At least write something :)");
1062
Statusbar1.Push(0, Catalog.GetString("At least write something :)"));
674
1064
GLib.Timeout.Add (3000, new GLib.TimeoutHandler (ClearStatusbar));
1067
PostEntry.Text = Catalog.GetString("What are you doing?");
678
1068
PostEntry.Sensitive = true;
1069
RefreshButton.Sensitive = true;
1070
menubar1.Sensitive = true;
680
1072
catch (NoSuchKeyException) {
682
1074
Gtk.Application.Invoke (delegate {
683
Statusbar1.Push(0, "Posting failed! No connection or wrong username/password.");
1075
Statusbar1.Push(0, Catalog.GetString("Posting failed!"));
687
1079
bool RefreshAfterPost()
689
Statusbar1.Push(0, "Connecting...");
1081
Statusbar1.Push(0, Catalog.GetString("Connecting..."));
690
1082
refreshThread = new Thread(new ThreadStart(DataThreadRoutine));
692
1084
refreshThread.Start();
722
1114
//140 characters counter
723
1115
protected virtual void OnPostEntryChanged(object sender, System.EventArgs e)
725
StatusLabel.Markup = String.Format("<span foreground='gray'>{0}</span>", (140 - PostEntry.Text.Length).ToString());
1117
// don't know if I should add a Catalog.GetString here
1118
if (PostEntry.Text == "What are you doing?")
1119
StatusLabel.Markup = "<span foreground='gray'>140</span>";
1121
StatusLabel.Markup = String.Format("<span foreground='gray'>{0}</span>", (140 - PostEntry.Text.Length).ToString());
1124
//user details show when clicking on user image
1126
private UrlLabel urlLabel2 = new UrlLabel();
1127
protected virtual void OnEventbox1ButtonPressEvent(object o, Gtk.ButtonPressEventArgs args)
1131
table1.Attach(urlLabel2, 1, 2, 4, 5, AttachOptions.Fill, AttachOptions.Shrink, 0, 0);
1132
urlLabel2.Xalign = 0.0f;
1135
urlLabel2.UrlActivated += delegate(object obj, UrlActivatedArgs args2) {
1136
Process.Start("gnome-open", args2.Url);
1142
if (TopNotebook.Page == 0 && !Direct.Active) {
1144
TopNotebook.Page = 1;
1149
TopNotebook.Page = 0;
1151
NameLabel.Text = "";
1152
ScreenNameLabel.Text = "";
1153
LocationLabel.Text = "";
1154
DescriptionLabel.Text = "";
1155
urlLabel2.Text = "";
1158
public void SetLabels() //set user detail labels
1160
NameLabel.Markup = readInfo.name[navigation];
1161
ScreenNameLabel.Markup = readInfo.screenName[navigation];
1162
LocationLabel.Markup = readInfo.location[navigation];
1163
DescriptionLabel.Markup = readInfo.description[navigation];
1164
string urlString = readInfo.url[navigation];
1165
urlLabel2.Markup = String.Format("<a href=\"{0}\">{1}</a>", urlString, urlString);
1167
if (NameLabel.Text.Length < 2) {
1168
label1.Visible = false;
1169
NameLabel.Visible = false;
1172
label1.Visible = true;
1173
NameLabel.Visible = true;
1176
if (ScreenNameLabel.Text.Length < 2) {
1177
label2.Visible = false;
1178
ScreenNameLabel.Visible = false;
1181
label2.Visible = true;
1182
ScreenNameLabel.Visible = true;
1185
if (LocationLabel.Text.Length < 2) {
1186
label3.Visible = false;
1187
LocationLabel.Visible = false;
1190
LocationLabel.Visible = true;
1191
label3.Visible = true;
1194
if (DescriptionLabel.Text.Length < 2) {
1195
label4.Visible = false;
1196
DescriptionLabel.Visible = false;
1199
label4.Visible = true;
1200
DescriptionLabel.Visible = true;
1203
if (urlLabel2.Text.Length < 2) {
1204
label5.Visible = false;
1205
urlLabel2.Visible = false;
1208
label5.Visible = true;
1209
urlLabel2.Visible = true;
1214
protected virtual void OnUserNEventboxButtonPressEvent(object o, Gtk.ButtonPressEventArgs args)
1217
UserNLabel.Markup = screenName;
1221
UserNLabel.Markup = "<span foreground='gray'>" + screenName + "</span>";
1228
//source radio buttons
1229
protected virtual void OnFriendsActivated(object sender, System.EventArgs e)
1231
if (Friends.Active) {
1232
client.Set (SOURCE_KEY, 0);
1234
Source.Label = Friends.Label;
1236
readStoredData = new Thread(new ThreadStart(ReadStoredData));
1237
readStoredData.Start();
1240
protected virtual void OnPublicActivated(object sender, System.EventArgs e)
1242
if (Public.Active) {
1243
client.Set (SOURCE_KEY, 1);
1245
Source.Label = Public.Label;
1247
readStoredData = new Thread(new ThreadStart(ReadStoredData));
1248
readStoredData.Start();
1251
protected virtual void OnDirectActivated(object sender, System.EventArgs e)
1253
if (Direct.Active) {
1254
client.Set (SOURCE_KEY, 2);
1256
Source.Label = Direct.Label;
1258
readStoredData = new Thread(new ThreadStart(ReadStoredData));
1259
readStoredData.Start();
1263
protected virtual void OnTweetViewActivated(object sender, System.EventArgs e)
1265
if (TweetView.Active) {
1267
client.Set(FANCY_UI_KEY, true);
1269
vpaned1.Child1.Visible = false;
1270
alignment1.TopPadding = 6;
1272
populateTreeview = new Thread(new ThreadStart(PopulateTreeviewThreadRoutine));
1274
populateTreeview.Start();
1278
client.Set(FANCY_UI_KEY, false);
1280
vpaned1.Child1.Visible = true;
1281
alignment1.TopPadding = 0;
1283
populateTreeview = new Thread(new ThreadStart(PopulateTreeviewThreadRoutine));
1285
populateTreeview.Start();
1289
//focus post entry on window focus
1290
protected virtual void OnFocusInEvent(object o, Gtk.FocusInEventArgs args)
1292
PostEntry.GrabFocus();