@@ -32,6 +32,7 @@ public class MyGrid: GLib.Object{
32
32
Gtk . Label droplabel;
33
33
public Gtk . Entry port1;
34
34
int64 to;
35
+ string last_from= " " ;
35
36
bool running = true ;
36
37
// public MyBrowser browser;
37
38
@@ -268,11 +269,14 @@ public class MyGrid: GLib.Object{
268
269
this . msg_win. remove(this . msgs);
269
270
}
270
271
this . msgs = this . boxes[id. to_string()];
272
+
271
273
this . msg_win. add(this . msgs);
272
274
Gtk . Grid grid = this . frd_boxes[id. to_string()];
273
275
var sc3 = grid. get_style_context();
276
+ // print("before crash 1\n");
274
277
sc3. remove_provider(this . mark1);
275
278
if ( sc3. has_class(" mark" ) ){
279
+ // print("before crash 2\n");
276
280
sc3. remove_class(" mark" );
277
281
this . mark_num-- ;
278
282
if (this . mark_num== 0 )
@@ -282,9 +286,10 @@ public class MyGrid: GLib.Object{
282
286
}else {
283
287
this . msg_win. show_all();
284
288
}
289
+ // print("before crash 3\n");
285
290
scroll_msgbox();
286
291
});
287
-
292
+ // print("before crash 4\n");
288
293
set_css_once();
289
294
}
290
295
public void send_uri1 (string [] uris ){
@@ -552,6 +557,27 @@ label{
552
557
// r.hide();
553
558
this . friends. remove( r );
554
559
}
560
+
561
+ public void set_last_from (string fid ) {
562
+ this . last_from= fid;
563
+ }
564
+ public void select_last_from () {
565
+ if (this . last_from== " " ){
566
+ return ;
567
+ }
568
+ var grid = this . frd_boxes[this . last_from];
569
+ Gtk . ListBoxRow r = grid. get_parent() as Gtk . ListBoxRow ;
570
+ this . friends. select_row(r);
571
+ }
572
+ public string get_user_id (string uname ) {
573
+ foreach ( var v in this . frds1. values ){
574
+ if ( v. name== uname ){
575
+ // print (@"get_user_id: $(v.id) - $(uname)\n");
576
+ return v. id. to_string();
577
+ }
578
+ }
579
+ return " " ;
580
+ }
555
581
public void add_right_name_icon (string name ,int16 sex ){
556
582
string iconp;
557
583
if (sex== 1 )
@@ -899,6 +925,12 @@ public void msg_notify(string uname){
899
925
var notify1 = new Notification (_(" New message" ));
900
926
notify1. set_body(_(" From: " )+ uname);
901
927
notify1. set_default_action(" app.show-win" );
928
+
929
+ var fid= grid1. get_user_id(uname);
930
+ if (fid!= " " ) {
931
+ grid1. set_last_from(fid);
932
+ }
933
+
902
934
app. send_notification(null ,notify1);
903
935
app. release();
904
936
#endif
@@ -996,6 +1028,7 @@ public class AppWin:Gtk.ApplicationWindow{
996
1028
if (grid1. mark_num== 0 ){
997
1029
this . clear_notify();
998
1030
}
1031
+ grid1. select_last_from();
999
1032
});
1000
1033
// Method called on pressing [X]
1001
1034
this . set_destroy_with_parent(false );
0 commit comments