Mercurial > pidgin
annotate console/gntblist.c @ 15589:d07c1e2e0496
merge of 'efde7d02b602348f7af4ff6a3c8364f9aabea9df'
and 'f59170f361556a597e522badf428349c3573bfe9'
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Fri, 09 Feb 2007 02:21:08 +0000 |
parents | 704d40050800 |
children | 35fa1d1c4ef2 |
rev | line source |
---|---|
14558
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
1 /** |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
2 * @file gntblist.c GNT BuddyList API |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
3 * @ingroup gntui |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
4 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
5 * gaim |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
6 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
7 * Gaim is the legal property of its developers, whose names are too numerous |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
8 * to list here. Please refer to the COPYRIGHT file distributed with this |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
9 * source distribution. |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
10 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
11 * This program is free software; you can redistribute it and/or modify |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
12 * it under the terms of the GNU General Public License as published by |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
13 * the Free Software Foundation; either version 2 of the License, or |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
14 * (at your option) any later version. |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
15 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
16 * This program is distributed in the hope that it will be useful, |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
19 * GNU General Public License for more details. |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
20 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
21 * You should have received a copy of the GNU General Public License |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
22 * along with this program; if not, write to the Free Software |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
24 */ |
13877
765bbdf29d04
[gaim-migrate @ 16354]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
25 #include <account.h> |
765bbdf29d04
[gaim-migrate @ 16354]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
26 #include <blist.h> |
14062
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
27 #include <notify.h> |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
28 #include <request.h> |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
29 #include <savedstatuses.h> |
13877
765bbdf29d04
[gaim-migrate @ 16354]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
30 #include <server.h> |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
31 #include <signal.h> |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
32 #include <status.h> |
13877
765bbdf29d04
[gaim-migrate @ 16354]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
33 #include <util.h> |
14694
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
34 #include "debug.h" |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
35 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
36 #include "gntgaim.h" |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
37 #include "gntbox.h" |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
38 #include "gntcombobox.h" |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
39 #include "gntentry.h" |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
40 #include "gntlabel.h" |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
41 #include "gntline.h" |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
42 #include "gntmenu.h" |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
43 #include "gntmenuitem.h" |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
44 #include "gntmenuitemcheck.h" |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
45 #include "gnttree.h" |
14935
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
46 #include "gntutils.h" |
14616
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
47 #include "gntwindow.h" |
15502
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
48 #include "gntpounce.h" |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
49 |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
50 #include "gntblist.h" |
14388
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14385
diff
changeset
|
51 #include "gntconv.h" |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
52 #include "gntstatus.h" |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
53 #include <string.h> |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
54 |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
55 #define PREF_ROOT "/gaim/gnt/blist" |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
56 #define TYPING_TIMEOUT 4000 |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
57 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
58 typedef struct |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
59 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
60 GntWidget *window; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
61 GntWidget *tree; |
13857
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
62 |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
63 GntWidget *tooltip; |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
64 GaimBlistNode *tnode; /* Who is the tooltip being displayed for? */ |
14977
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
65 GList *tagged; /* A list of tagged blistnodes */ |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
66 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
67 GntWidget *context; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
68 GaimBlistNode *cnode; |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
69 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
70 /* XXX: I am KISSing */ |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
71 GntWidget *status; /* Dropdown with the statuses */ |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
72 GntWidget *statustext; /* Status message */ |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
73 int typing; |
14883
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
74 |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
75 GntWidget *menu; |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
76 /* These are the menuitems that get regenerated */ |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
77 GntMenuItem *accounts; |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
78 GntMenuItem *plugins; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
79 } GGBlist; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
80 |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
81 typedef enum |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
82 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
83 STATUS_PRIMITIVE = 0, |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
84 STATUS_SAVED_POPULAR, |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
85 STATUS_SAVED_ALL, |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
86 STATUS_SAVED_NEW |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
87 } StatusType; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
88 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
89 typedef struct |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
90 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
91 StatusType type; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
92 union |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
93 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
94 GaimStatusPrimitive prim; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
95 GaimSavedStatus *saved; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
96 } u; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
97 } StatusBoxItem; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
98 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
99 GGBlist *ggblist; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
100 |
13857
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
101 static void add_buddy(GaimBuddy *buddy, GGBlist *ggblist); |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
102 static void add_contact(GaimContact *contact, GGBlist *ggblist); |
13857
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
103 static void add_group(GaimGroup *group, GGBlist *ggblist); |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
104 static void add_chat(GaimChat *chat, GGBlist *ggblist); |
13865
d78ab363e02d
[gaim-migrate @ 16331]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13864
diff
changeset
|
105 static void add_node(GaimBlistNode *node, GGBlist *ggblist); |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
106 static void draw_tooltip(GGBlist *ggblist); |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14042
diff
changeset
|
107 static gboolean remove_typing_cb(gpointer null); |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
108 static void remove_peripherals(GGBlist *ggblist); |
14018
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
109 static const char * get_display_name(GaimBlistNode *node); |
14131
db2311999862
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
110 static void savedstatus_changed(GaimSavedStatus *now, GaimSavedStatus *old); |
14847
d478f3853671
[gaim-migrate @ 17616]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14846
diff
changeset
|
111 static void blist_show(GaimBuddyList *list); |
14977
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
112 static void update_buddy_display(GaimBuddy *buddy, GGBlist *ggblist); |
15182 | 113 static void account_signed_on_cb(void); |
13857
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
114 |
14712
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
115 /* Sort functions */ |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
116 static int blist_node_compare_text(GaimBlistNode *n1, GaimBlistNode *n2); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
117 static int blist_node_compare_status(GaimBlistNode *n1, GaimBlistNode *n2); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
118 static int blist_node_compare_log(GaimBlistNode *n1, GaimBlistNode *n2); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
119 |
14407
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
120 static gboolean |
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
121 is_contact_online(GaimContact *contact) |
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
122 { |
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
123 GaimBlistNode *node; |
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
124 for (node = ((GaimBlistNode*)contact)->child; node; node = node->next) { |
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
125 if (GAIM_BUDDY_IS_ONLINE((GaimBuddy*)node)) |
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
126 return TRUE; |
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
127 } |
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
128 return FALSE; |
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
129 } |
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
130 |
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
131 static gboolean |
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
132 is_group_online(GaimGroup *group) |
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
133 { |
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
134 GaimBlistNode *node; |
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
135 for (node = ((GaimBlistNode*)group)->child; node; node = node->next) { |
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
136 if (GAIM_BLIST_NODE_IS_CHAT(node)) |
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
137 return TRUE; |
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
138 else if (is_contact_online((GaimContact*)node)) |
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
139 return TRUE; |
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
140 } |
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
141 return FALSE; |
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
142 } |
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
143 |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
144 static void |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
145 new_node(GaimBlistNode *node) |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
146 { |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
147 } |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
148 |
13865
d78ab363e02d
[gaim-migrate @ 16331]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13864
diff
changeset
|
149 static void add_node(GaimBlistNode *node, GGBlist *ggblist) |
d78ab363e02d
[gaim-migrate @ 16331]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13864
diff
changeset
|
150 { |
d78ab363e02d
[gaim-migrate @ 16331]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13864
diff
changeset
|
151 if (GAIM_BLIST_NODE_IS_BUDDY(node)) |
d78ab363e02d
[gaim-migrate @ 16331]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13864
diff
changeset
|
152 add_buddy((GaimBuddy*)node, ggblist); |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
153 else if (GAIM_BLIST_NODE_IS_CONTACT(node)) |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
154 add_contact((GaimContact*)node, ggblist); |
13865
d78ab363e02d
[gaim-migrate @ 16331]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13864
diff
changeset
|
155 else if (GAIM_BLIST_NODE_IS_GROUP(node)) |
d78ab363e02d
[gaim-migrate @ 16331]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13864
diff
changeset
|
156 add_group((GaimGroup*)node, ggblist); |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
157 else if (GAIM_BLIST_NODE_IS_CHAT(node)) |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
158 add_chat((GaimChat *)node, ggblist); |
13865
d78ab363e02d
[gaim-migrate @ 16331]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13864
diff
changeset
|
159 draw_tooltip(ggblist); |
d78ab363e02d
[gaim-migrate @ 16331]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13864
diff
changeset
|
160 } |
d78ab363e02d
[gaim-migrate @ 16331]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13864
diff
changeset
|
161 |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
162 static void |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
163 remove_tooltip(GGBlist *ggblist) |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
164 { |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
165 gnt_widget_destroy(ggblist->tooltip); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
166 ggblist->tooltip = NULL; |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
167 ggblist->tnode = NULL; |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
168 } |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
169 |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
170 static void |
13857
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
171 node_remove(GaimBuddyList *list, GaimBlistNode *node) |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
172 { |
13857
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
173 GGBlist *ggblist = list->ui_data; |
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
174 |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
175 if (ggblist == NULL || node->ui_data == NULL) |
13857
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
176 return; |
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
177 |
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
178 gnt_tree_remove(GNT_TREE(ggblist->tree), node); |
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
179 node->ui_data = NULL; |
14977
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
180 if (ggblist->tagged) |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
181 ggblist->tagged = g_list_remove(ggblist->tagged, node); |
13857
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
182 |
14399
28baa42b5ac2
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
183 if (GAIM_BLIST_NODE_IS_BUDDY(node)) { |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
184 GaimContact *contact = (GaimContact*)node->parent; |
14407
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
185 if ((!gaim_prefs_get_bool(PREF_ROOT "/showoffline") && !is_contact_online(contact)) || |
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
186 contact->currentsize < 1) |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
187 node_remove(list, (GaimBlistNode*)contact); |
14399
28baa42b5ac2
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
188 } else if (GAIM_BLIST_NODE_IS_CONTACT(node)) { |
28baa42b5ac2
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
189 GaimGroup *group = (GaimGroup*)node->parent; |
14407
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
190 if ((!gaim_prefs_get_bool(PREF_ROOT "/showoffline") && !is_group_online(group)) || |
14399
28baa42b5ac2
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
191 group->currentsize < 1) |
28baa42b5ac2
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
192 node_remove(list, node->parent); |
14977
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
193 for (node = node->child; node; node = node->next) |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
194 node->ui_data = NULL; |
13857
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
195 } |
14848
6d9db29f4c10
[gaim-migrate @ 17617]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14847
diff
changeset
|
196 |
14935
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
197 draw_tooltip(ggblist); |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
198 } |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
199 |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
200 static void |
13857
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
201 node_update(GaimBuddyList *list, GaimBlistNode *node) |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
202 { |
14393 | 203 /* It really looks like this should never happen ... but it does. |
204 This will at least emit a warning to the log when it | |
205 happens, so maybe someone will figure it out. */ | |
206 g_return_if_fail(node != NULL); | |
207 | |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
208 if (list->ui_data == NULL) |
14396
9e9699792bb9
[gaim-migrate @ 17104]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14393
diff
changeset
|
209 return; /* XXX: this is probably the place to auto-join chats */ |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
210 |
14385
d1e4e986bbd1
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14384
diff
changeset
|
211 if (node->ui_data != NULL) { |
14018
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
212 gnt_tree_change_text(GNT_TREE(ggblist->tree), node, |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
213 0, get_display_name(node)); |
14712
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
214 gnt_tree_sort_row(GNT_TREE(ggblist->tree), node); |
14018
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
215 } |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
216 |
14385
d1e4e986bbd1
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14384
diff
changeset
|
217 if (GAIM_BLIST_NODE_IS_BUDDY(node)) { |
13857
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
218 GaimBuddy *buddy = (GaimBuddy*)node; |
14399
28baa42b5ac2
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
219 if (gaim_account_is_connected(buddy->account) && |
28baa42b5ac2
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
220 (GAIM_BUDDY_IS_ONLINE(buddy) || gaim_prefs_get_bool(PREF_ROOT "/showoffline"))) |
13865
d78ab363e02d
[gaim-migrate @ 16331]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13864
diff
changeset
|
221 add_node((GaimBlistNode*)buddy, list->ui_data); |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
222 else |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
223 node_remove(gaim_get_blist(), node); |
14385
d1e4e986bbd1
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14384
diff
changeset
|
224 |
d1e4e986bbd1
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14384
diff
changeset
|
225 node_update(list, node->parent); |
d1e4e986bbd1
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14384
diff
changeset
|
226 } else if (GAIM_BLIST_NODE_IS_CHAT(node)) { |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
227 add_chat((GaimChat *)node, list->ui_data); |
14407
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
228 } else if (GAIM_BLIST_NODE_IS_CONTACT(node)) { |
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
229 GaimContact *contact = (GaimContact*)node; |
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
230 if ((!gaim_prefs_get_bool(PREF_ROOT "/showoffline") && !is_contact_online(contact)) || |
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
231 contact->currentsize < 1) |
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
232 node_remove(gaim_get_blist(), node); |
14708
ef94c6b853ab
[gaim-migrate @ 17462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14694
diff
changeset
|
233 else |
ef94c6b853ab
[gaim-migrate @ 17462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14694
diff
changeset
|
234 add_node(node, list->ui_data); |
14407
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
235 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) { |
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
236 GaimGroup *group = (GaimGroup*)node; |
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
237 if ((!gaim_prefs_get_bool(PREF_ROOT "/showoffline") && !is_group_online(group)) || |
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
238 group->currentsize < 1) |
2a5ec27c3f0c
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
239 node_remove(list, node); |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
240 } |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
241 } |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
242 |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
243 static void |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
244 new_list(GaimBuddyList *list) |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
245 { |
14847
d478f3853671
[gaim-migrate @ 17616]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14846
diff
changeset
|
246 if (ggblist) |
d478f3853671
[gaim-migrate @ 17616]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14846
diff
changeset
|
247 return; |
d478f3853671
[gaim-migrate @ 17616]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14846
diff
changeset
|
248 |
d478f3853671
[gaim-migrate @ 17616]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14846
diff
changeset
|
249 ggblist = g_new0(GGBlist, 1); |
d478f3853671
[gaim-migrate @ 17616]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14846
diff
changeset
|
250 list->ui_data = ggblist; |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
251 } |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
252 |
14062
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
253 static void |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
254 add_buddy_cb(void *data, GaimRequestFields *allfields) |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
255 { |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
256 const char *username = gaim_request_fields_get_string(allfields, "screenname"); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
257 const char *alias = gaim_request_fields_get_string(allfields, "alias"); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
258 const char *group = gaim_request_fields_get_string(allfields, "group"); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
259 GaimAccount *account = gaim_request_fields_get_account(allfields, "account"); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
260 const char *error = NULL; |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
261 GaimGroup *grp; |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
262 GaimBuddy *buddy; |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
263 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
264 if (!username) |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
265 error = _("You must provide a screename for the buddy."); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
266 else if (!group) |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
267 error = _("You must provide a group."); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
268 else if (!account) |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
269 error = _("You must select an account."); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
270 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
271 if (error) |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
272 { |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
273 gaim_notify_error(NULL, _("Error"), _("Error adding buddy"), error); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
274 return; |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
275 } |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
276 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
277 grp = gaim_find_group(group); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
278 if (!grp) |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
279 { |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
280 grp = gaim_group_new(group); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
281 gaim_blist_add_group(grp, NULL); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
282 } |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
283 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
284 buddy = gaim_buddy_new(account, username, alias); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
285 gaim_blist_add_buddy(buddy, NULL, grp, NULL); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
286 gaim_account_add_buddy(account, buddy); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
287 } |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
288 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
289 static void |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
290 gg_request_add_buddy(GaimAccount *account, const char *username, const char *grp, const char *alias) |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
291 { |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
292 GaimRequestFields *fields = gaim_request_fields_new(); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
293 GaimRequestFieldGroup *group = gaim_request_field_group_new(NULL); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
294 GaimRequestField *field; |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
295 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
296 gaim_request_fields_add_group(fields, group); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
297 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
298 field = gaim_request_field_string_new("screenname", _("Screen Name"), username, FALSE); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
299 gaim_request_field_group_add_field(group, field); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
300 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
301 field = gaim_request_field_string_new("alias", _("Alias"), alias, FALSE); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
302 gaim_request_field_group_add_field(group, field); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
303 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
304 field = gaim_request_field_string_new("group", _("Group"), grp, FALSE); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
305 gaim_request_field_group_add_field(group, field); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
306 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
307 field = gaim_request_field_account_new("account", _("Account"), NULL); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
308 gaim_request_field_account_set_show_all(field, FALSE); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
309 if (account) |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
310 gaim_request_field_account_set_value(field, account); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
311 gaim_request_field_group_add_field(group, field); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
312 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
313 gaim_request_fields(NULL, _("Add Buddy"), NULL, _("Please enter buddy information."), |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
314 fields, _("Add"), G_CALLBACK(add_buddy_cb), _("Cancel"), NULL, NULL); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
315 } |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
316 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
317 static void |
14351
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
318 add_chat_cb(void *data, GaimRequestFields *allfields) |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
319 { |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
320 GaimAccount *account; |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
321 const char *alias, *name, *group; |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
322 GaimChat *chat; |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
323 GaimGroup *grp; |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
324 GHashTable *hash = NULL; |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
325 GaimConnection *gc; |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
326 |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
327 account = gaim_request_fields_get_account(allfields, "account"); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
328 name = gaim_request_fields_get_string(allfields, "name"); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
329 alias = gaim_request_fields_get_string(allfields, "alias"); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
330 group = gaim_request_fields_get_string(allfields, "group"); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
331 |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
332 if (!gaim_account_is_connected(account) || !name || !*name) |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
333 return; |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
334 |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
335 if (!group || !*group) |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
336 group = _("Chats"); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
337 |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
338 gc = gaim_account_get_connection(account); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
339 |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
340 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults != NULL) |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
341 hash = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults(gc, name); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
342 |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
343 chat = gaim_chat_new(account, name, hash); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
344 |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
345 if (chat != NULL) { |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
346 if ((grp = gaim_find_group(group)) == NULL) { |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
347 grp = gaim_group_new(group); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
348 gaim_blist_add_group(grp, NULL); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
349 } |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
350 gaim_blist_add_chat(chat, grp, NULL); |
14691 | 351 gaim_blist_alias_chat(chat, alias); |
14351
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
352 } |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
353 } |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
354 |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
355 static void |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
356 gg_request_add_chat(GaimAccount *account, GaimGroup *grp, const char *alias, const char *name) |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
357 { |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
358 GaimRequestFields *fields = gaim_request_fields_new(); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
359 GaimRequestFieldGroup *group = gaim_request_field_group_new(NULL); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
360 GaimRequestField *field; |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
361 |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
362 gaim_request_fields_add_group(fields, group); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
363 |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
364 field = gaim_request_field_account_new("account", _("Account"), NULL); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
365 gaim_request_field_account_set_show_all(field, FALSE); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
366 if (account) |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
367 gaim_request_field_account_set_value(field, account); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
368 gaim_request_field_group_add_field(group, field); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
369 |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
370 field = gaim_request_field_string_new("name", _("Name"), name, FALSE); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
371 gaim_request_field_group_add_field(group, field); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
372 |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
373 field = gaim_request_field_string_new("alias", _("Alias"), alias, FALSE); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
374 gaim_request_field_group_add_field(group, field); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
375 |
14694
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
376 field = gaim_request_field_string_new("group", _("Group"), grp ? grp->name : NULL, FALSE); |
14351
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
377 gaim_request_field_group_add_field(group, field); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
378 |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
379 gaim_request_fields(NULL, _("Add Chat"), NULL, |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
380 _("You can edit more information from the context menu later."), |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
381 fields, _("Add"), G_CALLBACK(add_chat_cb), _("Cancel"), NULL, NULL); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
382 } |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
383 |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
384 static void |
14062
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
385 add_group_cb(gpointer null, const char *group) |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
386 { |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
387 GaimGroup *grp; |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
388 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
389 if (!group || !*group) |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
390 { |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
391 gaim_notify_error(NULL, _("Error"), _("Error adding group"), |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
392 _("You must give a name for the group to add.")); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
393 return; |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
394 } |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
395 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
396 grp = gaim_find_group(group); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
397 if (!grp) |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
398 { |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
399 grp = gaim_group_new(group); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
400 gaim_blist_add_group(grp, NULL); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
401 } |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
402 else |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
403 { |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
404 gaim_notify_error(NULL, _("Error"), _("Error adding group"), |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
405 _("A group with the name already exists.")); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
406 } |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
407 } |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
408 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
409 static void |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
410 gg_request_add_group() |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
411 { |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
412 gaim_request_input(NULL, _("Add Group"), NULL, _("Enter the name of the group"), |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
413 NULL, FALSE, FALSE, NULL, |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
414 _("Add"), G_CALLBACK(add_group_cb), _("Cancel"), NULL, NULL); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
415 } |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
416 |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
417 static GaimBlistUiOps blist_ui_ops = |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
418 { |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
419 new_list, |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
420 new_node, |
14847
d478f3853671
[gaim-migrate @ 17616]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14846
diff
changeset
|
421 blist_show, |
14385
d1e4e986bbd1
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14384
diff
changeset
|
422 node_update, |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
423 node_remove, |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
424 NULL, |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
425 NULL, |
14062
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
426 .request_add_buddy = gg_request_add_buddy, |
14351
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
427 .request_add_chat = gg_request_add_chat, |
14062
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
428 .request_add_group = gg_request_add_group |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
429 }; |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
430 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
431 static gpointer |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
432 gg_blist_get_handle() |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
433 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
434 static int handle; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
435 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
436 return &handle; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
437 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
438 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
439 static void |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
440 add_group(GaimGroup *group, GGBlist *ggblist) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
441 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
442 GaimBlistNode *node = (GaimBlistNode *)group; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
443 if (node->ui_data) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
444 return; |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
445 node->ui_data = gnt_tree_add_row_after(GNT_TREE(ggblist->tree), group, |
14018
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
446 gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)), NULL, NULL); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
447 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
448 |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
449 static const char * |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
450 get_display_name(GaimBlistNode *node) |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
451 { |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
452 static char text[2096]; |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
453 char status[8] = " "; |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
454 const char *name = NULL; |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
455 |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
456 if (GAIM_BLIST_NODE_IS_CONTACT(node)) |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
457 node = (GaimBlistNode*)gaim_contact_get_priority_buddy((GaimContact*)node); /* XXX: this can return NULL?! */ |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
458 |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
459 if (node == NULL) |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
460 return NULL; |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
461 |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
462 if (GAIM_BLIST_NODE_IS_BUDDY(node)) |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
463 { |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
464 GaimBuddy *buddy = (GaimBuddy *)node; |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
465 GaimStatusPrimitive prim; |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
466 GaimPresence *presence; |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
467 GaimStatus *now; |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13916
diff
changeset
|
468 gboolean ascii = gnt_ascii_only(); |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
469 |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
470 presence = gaim_buddy_get_presence(buddy); |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
471 now = gaim_presence_get_active_status(presence); |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
472 |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
473 prim = gaim_status_type_get_primitive(gaim_status_get_type(now)); |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
474 |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
475 switch(prim) |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
476 { |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
477 case GAIM_STATUS_OFFLINE: |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13916
diff
changeset
|
478 strncpy(status, ascii ? "x" : "⊗", sizeof(status) - 1); |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
479 break; |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
480 case GAIM_STATUS_AVAILABLE: |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13916
diff
changeset
|
481 strncpy(status, ascii ? "o" : "â—¯", sizeof(status) - 1); |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
482 break; |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
483 default: |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13916
diff
changeset
|
484 strncpy(status, ascii ? "." : "⊖", sizeof(status) - 1); |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
485 break; |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
486 } |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
487 name = gaim_buddy_get_alias(buddy); |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
488 } |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
489 else if (GAIM_BLIST_NODE_IS_CHAT(node)) |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
490 { |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
491 GaimChat *chat = (GaimChat*)node; |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
492 name = gaim_chat_get_name(chat); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13884
diff
changeset
|
493 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13884
diff
changeset
|
494 strncpy(status, "~", sizeof(status) - 1); |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
495 } |
14018
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
496 else if (GAIM_BLIST_NODE_IS_GROUP(node)) |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
497 return ((GaimGroup*)node)->name; |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
498 |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
499 snprintf(text, sizeof(text) - 1, "%s %s", status, name); |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
500 |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
501 return text; |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
502 } |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
503 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
504 static void |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
505 add_chat(GaimChat *chat, GGBlist *ggblist) |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
506 { |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
507 GaimGroup *group; |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
508 GaimBlistNode *node = (GaimBlistNode *)chat; |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
509 if (node->ui_data) |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
510 return; |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
511 if (!gaim_account_is_connected(chat->account)) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
512 return; |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
513 |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
514 group = gaim_chat_get_group(chat); |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
515 add_node((GaimBlistNode*)group, ggblist); |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
516 |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
517 node->ui_data = gnt_tree_add_row_after(GNT_TREE(ggblist->tree), chat, |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13959
diff
changeset
|
518 gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)), |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13959
diff
changeset
|
519 group, NULL); |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
520 } |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
521 |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
522 static void |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
523 add_contact(GaimContact *contact, GGBlist *ggblist) |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
524 { |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
525 GaimGroup *group; |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
526 GaimBlistNode *node = (GaimBlistNode*)contact; |
14399
28baa42b5ac2
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
527 const char *name; |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
528 |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
529 if (node->ui_data) |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
530 return; |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
531 |
14399
28baa42b5ac2
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
532 name = get_display_name(node); |
28baa42b5ac2
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
533 if (name == NULL) |
28baa42b5ac2
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
534 return; |
28baa42b5ac2
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
535 |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
536 group = (GaimGroup*)node->parent; |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
537 add_node((GaimBlistNode*)group, ggblist); |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
538 |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
539 node->ui_data = gnt_tree_add_row_after(GNT_TREE(ggblist->tree), contact, |
14399
28baa42b5ac2
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
540 gnt_tree_create_row(GNT_TREE(ggblist->tree), name), |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
541 group, NULL); |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
542 |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
543 gnt_tree_set_expanded(GNT_TREE(ggblist->tree), contact, FALSE); |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
544 } |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
545 |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
546 static void |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
547 add_buddy(GaimBuddy *buddy, GGBlist *ggblist) |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
548 { |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
549 GaimContact *contact; |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
550 GaimBlistNode *node = (GaimBlistNode *)buddy; |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
551 if (node->ui_data) |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
552 return; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
553 |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
554 contact = (GaimContact*)node->parent; |
14708
ef94c6b853ab
[gaim-migrate @ 17462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14694
diff
changeset
|
555 if (!contact) /* When a new buddy is added and show-offline is set */ |
ef94c6b853ab
[gaim-migrate @ 17462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14694
diff
changeset
|
556 return; |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
557 add_node((GaimBlistNode*)contact, ggblist); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
558 |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
559 node->ui_data = gnt_tree_add_row_after(GNT_TREE(ggblist->tree), buddy, |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13959
diff
changeset
|
560 gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)), |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
561 contact, NULL); |
14385
d1e4e986bbd1
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14384
diff
changeset
|
562 if (gaim_presence_is_idle(gaim_buddy_get_presence(buddy))) { |
13931
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
563 gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), buddy, GNT_TEXT_FLAG_DIM); |
14385
d1e4e986bbd1
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14384
diff
changeset
|
564 gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), contact, GNT_TEXT_FLAG_DIM); |
d1e4e986bbd1
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14384
diff
changeset
|
565 } else { |
13931
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
566 gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), buddy, 0); |
14385
d1e4e986bbd1
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14384
diff
changeset
|
567 gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), contact, 0); |
d1e4e986bbd1
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14384
diff
changeset
|
568 } |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
569 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
570 |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
571 #if 0 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
572 static void |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
573 buddy_signed_on(GaimBuddy *buddy, GGBlist *ggblist) |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
574 { |
13865
d78ab363e02d
[gaim-migrate @ 16331]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13864
diff
changeset
|
575 add_node((GaimBlistNode*)buddy, ggblist); |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
576 } |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
577 |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
578 static void |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
579 buddy_signed_off(GaimBuddy *buddy, GGBlist *ggblist) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
580 { |
13861
55fb5cd9bac9
[gaim-migrate @ 16322]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
581 node_remove(gaim_get_blist(), (GaimBlistNode*)buddy); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
582 } |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
583 #endif |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
584 |
13857
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
585 GaimBlistUiOps *gg_blist_get_ui_ops() |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
586 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
587 return &blist_ui_ops; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
588 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
589 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
590 static void |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
591 selection_activate(GntWidget *widget, GGBlist *ggblist) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
592 { |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
593 GntTree *tree = GNT_TREE(ggblist->tree); |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
594 GaimBlistNode *node = gnt_tree_get_selection_data(tree); |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
595 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
596 if (!node) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
597 return; |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
598 |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
599 if (GAIM_BLIST_NODE_IS_CONTACT(node)) |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
600 node = (GaimBlistNode*)gaim_contact_get_priority_buddy((GaimContact*)node); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
601 |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
602 if (GAIM_BLIST_NODE_IS_BUDDY(node)) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
603 { |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
604 GaimBuddy *buddy = (GaimBuddy *)node; |
14388
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14385
diff
changeset
|
605 GaimConversation *conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14385
diff
changeset
|
606 gaim_buddy_get_account(buddy), |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14385
diff
changeset
|
607 gaim_buddy_get_name(buddy)); |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14385
diff
changeset
|
608 gg_conversation_set_active(conv); |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
609 } |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
610 else if (GAIM_BLIST_NODE_IS_CHAT(node)) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
611 { |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
612 GaimChat *chat = (GaimChat*)node; |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
613 serv_join_chat(chat->account->gc, chat->components); |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
614 } |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
615 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
616 |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
617 static void |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
618 context_menu_callback(GntMenuItem *item, gpointer data) |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
619 { |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
620 GaimMenuAction *action = data; |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
621 GaimBlistNode *node = ggblist->cnode; |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
622 if (action) { |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
623 void (*callback)(GaimBlistNode *, gpointer); |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
624 callback = (void (*)(GaimBlistNode *, gpointer))action->callback; |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
625 if (callback) |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
626 callback(action->data, node); |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
627 else |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
628 return; |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
629 } |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
630 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
631 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
632 static void |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
633 gnt_append_menu_action(GntMenu *menu, GaimMenuAction *action, gpointer parent) |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
634 { |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
635 GList *list; |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
636 GntMenuItem *item; |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
637 |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
638 if (action == NULL) |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
639 return; |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
640 |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
641 item = gnt_menuitem_new(action->label); |
14850
2405b9e6f05f
[gaim-migrate @ 17619]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14848
diff
changeset
|
642 if (action->callback) |
2405b9e6f05f
[gaim-migrate @ 17619]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14848
diff
changeset
|
643 gnt_menuitem_set_callback(GNT_MENUITEM(item), context_menu_callback, action); |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
644 gnt_menu_add_item(menu, GNT_MENUITEM(item)); |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
645 |
14850
2405b9e6f05f
[gaim-migrate @ 17619]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14848
diff
changeset
|
646 if (action->children) { |
2405b9e6f05f
[gaim-migrate @ 17619]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14848
diff
changeset
|
647 GntWidget *sub = gnt_menu_new(GNT_MENU_POPUP); |
2405b9e6f05f
[gaim-migrate @ 17619]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14848
diff
changeset
|
648 gnt_menuitem_set_submenu(item, GNT_MENU(sub)); |
2405b9e6f05f
[gaim-migrate @ 17619]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14848
diff
changeset
|
649 for (list = action->children; list; list = list->next) |
2405b9e6f05f
[gaim-migrate @ 17619]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14848
diff
changeset
|
650 gnt_append_menu_action(GNT_MENU(sub), list->data, action); |
2405b9e6f05f
[gaim-migrate @ 17619]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14848
diff
changeset
|
651 } |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
652 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
653 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
654 static void |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
655 append_proto_menu(GntMenu *menu, GaimConnection *gc, GaimBlistNode *node) |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
656 { |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
657 GList *list; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
658 GaimPluginProtocolInfo *prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
659 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
660 if(!prpl_info || !prpl_info->blist_node_menu) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
661 return; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
662 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
663 for(list = prpl_info->blist_node_menu(node); list; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
664 list = g_list_delete_link(list, list)) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
665 { |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
666 GaimMenuAction *act = (GaimMenuAction *) list->data; |
14470
c8704dd8059b
[gaim-migrate @ 17186]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14469
diff
changeset
|
667 act->data = node; |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
668 gnt_append_menu_action(menu, act, NULL); |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
669 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
670 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
671 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
672 static void |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
673 add_custom_action(GntMenu *menu, const char *label, GaimCallback callback, |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
674 gpointer data) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
675 { |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
676 GaimMenuAction *action = gaim_menu_action_new(label, callback, data, NULL); |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
677 gnt_append_menu_action(menu, action, NULL); |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
678 g_signal_connect_swapped(G_OBJECT(menu), "destroy", |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
679 G_CALLBACK(gaim_menu_action_free), action); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
680 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
681 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
682 static void |
14351
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
683 chat_components_edit_ok(GaimChat *chat, GaimRequestFields *allfields) |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
684 { |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
685 GList *groups, *fields; |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
686 |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
687 for (groups = gaim_request_fields_get_groups(allfields); groups; groups = groups->next) { |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
688 fields = gaim_request_field_group_get_fields(groups->data); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
689 for (; fields; fields = fields->next) { |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
690 GaimRequestField *field = fields->data; |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
691 const char *id; |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
692 char *val; |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
693 |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
694 id = gaim_request_field_get_id(field); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
695 if (gaim_request_field_get_type(field) == GAIM_REQUEST_FIELD_INTEGER) |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
696 val = g_strdup_printf("%d", gaim_request_field_int_get_value(field)); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
697 else |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
698 val = g_strdup(gaim_request_field_string_get_value(field)); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
699 |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
700 g_hash_table_replace(chat->components, g_strdup(id), val); /* val should not be free'd */ |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
701 } |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
702 } |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
703 } |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
704 |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
705 static void |
14469
ddfe82afecd8
[gaim-migrate @ 17185]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14427
diff
changeset
|
706 chat_components_edit(GaimChat *chat, GaimBlistNode *selected) |
14351
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
707 { |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
708 GaimRequestFields *fields = gaim_request_fields_new(); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
709 GaimRequestFieldGroup *group = gaim_request_field_group_new(NULL); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
710 GaimRequestField *field; |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
711 GList *parts, *iter; |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
712 struct proto_chat_entry *pce; |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
713 |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
714 gaim_request_fields_add_group(fields, group); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
715 |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
716 parts = GAIM_PLUGIN_PROTOCOL_INFO(chat->account->gc->prpl)->chat_info(chat->account->gc); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
717 |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
718 for (iter = parts; iter; iter = iter->next) { |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
719 pce = iter->data; |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
720 if (pce->is_int) { |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
721 int val; |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
722 const char *str = g_hash_table_lookup(chat->components, pce->identifier); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
723 if (!str || sscanf(str, "%d", &val) != 1) |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
724 val = pce->min; |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
725 field = gaim_request_field_int_new(pce->identifier, pce->label, val); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
726 } else { |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
727 field = gaim_request_field_string_new(pce->identifier, pce->label, |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
728 g_hash_table_lookup(chat->components, pce->identifier), FALSE); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
729 } |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
730 |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
731 gaim_request_field_group_add_field(group, field); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
732 g_free(pce); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
733 } |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
734 |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
735 g_list_free(parts); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
736 |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
737 gaim_request_fields(NULL, _("Edit Chat"), NULL, _("Please Update the necessary fields."), |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
738 fields, _("Edit"), G_CALLBACK(chat_components_edit_ok), _("Cancel"), NULL, chat); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
739 } |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
740 |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
741 static void |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
742 autojoin_toggled(GntMenuItem *item, gpointer data) |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
743 { |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
744 GaimMenuAction *action = data; |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
745 gaim_blist_node_set_bool(action->data, "gnt-autojoin", |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
746 gnt_menuitem_check_get_checked(GNT_MENUITEM_CHECK(item))); |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
747 } |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
748 |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
749 static void |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
750 create_chat_menu(GntMenu *menu, GaimChat *chat) |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
751 { |
14105
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
752 GaimMenuAction *action = gaim_menu_action_new(_("Auto-join"), NULL, chat, NULL); |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
753 GntMenuItem *check = gnt_menuitem_check_new(action->label); |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
754 gnt_menuitem_check_set_checked(GNT_MENUITEM_CHECK(check), |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
755 gaim_blist_node_get_bool((GaimBlistNode*)chat, "gnt-autojoin")); |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
756 gnt_menu_add_item(menu, check); |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
757 gnt_menuitem_set_callback(check, autojoin_toggled, action); |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
758 g_signal_connect_swapped(G_OBJECT(menu), "destroy", |
14105
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
759 G_CALLBACK(gaim_menu_action_free), action); |
14351
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
760 |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
761 add_custom_action(menu, _("Edit Settings"), (GaimCallback)chat_components_edit, chat); |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
762 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
763 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
764 static void |
14469
ddfe82afecd8
[gaim-migrate @ 17185]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14427
diff
changeset
|
765 gg_add_buddy(GaimGroup *grp, GaimBlistNode *selected) |
14062
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
766 { |
14694
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
767 gaim_blist_request_add_buddy(NULL, NULL, grp ? grp->name : NULL, NULL); |
14062
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
768 } |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
769 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
770 static void |
14469
ddfe82afecd8
[gaim-migrate @ 17185]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14427
diff
changeset
|
771 gg_add_group(GaimGroup *grp, GaimBlistNode *selected) |
14062
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
772 { |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
773 gaim_blist_request_add_group(); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
774 } |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
775 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
776 static void |
14469
ddfe82afecd8
[gaim-migrate @ 17185]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14427
diff
changeset
|
777 gg_add_chat(GaimGroup *grp, GaimBlistNode *selected) |
14351
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
778 { |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
779 gaim_blist_request_add_chat(NULL, grp, NULL, NULL); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
780 } |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
781 |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
782 static void |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
783 create_group_menu(GntMenu *menu, GaimGroup *group) |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
784 { |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
785 add_custom_action(menu, _("Add Buddy"), |
14062
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
786 GAIM_CALLBACK(gg_add_buddy), group); |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
787 add_custom_action(menu, _("Add Chat"), |
14351
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
788 GAIM_CALLBACK(gg_add_chat), group); |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
789 add_custom_action(menu, _("Add Group"), |
14062
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
790 GAIM_CALLBACK(gg_add_group), group); |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
791 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
792 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
793 static void |
14469
ddfe82afecd8
[gaim-migrate @ 17185]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14427
diff
changeset
|
794 gg_blist_get_buddy_info_cb(GaimBuddy *buddy, GaimBlistNode *selected) |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
795 { |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
796 serv_get_info(buddy->account->gc, gaim_buddy_get_name(buddy)); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
797 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
798 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
799 static void |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
800 create_buddy_menu(GntMenu *menu, GaimBuddy *buddy) |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
801 { |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
802 GaimPluginProtocolInfo *prpl_info; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
803 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
804 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(buddy->account->gc->prpl); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
805 if (prpl_info && prpl_info->get_info) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
806 { |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
807 add_custom_action(menu, _("Get Info"), |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
808 GAIM_CALLBACK(gg_blist_get_buddy_info_cb), buddy); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
809 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
810 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
811 #if 0 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
812 add_custom_action(tree, _("Add Buddy Pounce"), |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
813 GAIM_CALLBACK(gg_blist_add_buddy_pounce_cb)), buddy); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
814 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
815 if (prpl_info && prpl_info->send_file) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
816 { |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
817 if (!prpl_info->can_receive_file || |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
818 prpl_info->can_receive_file(buddy->account->gc, buddy->name)) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
819 add_custom_action(tree, _("Send File"), |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
820 GAIM_CALLBACK(gg_blist_show_file_cb)), buddy); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
821 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
822 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
823 add_custom_action(tree, _("View Log"), |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
824 GAIM_CALLBACK(gg_blist_view_log_cb)), buddy); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
825 #endif |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
826 |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
827 /* Protocol actions */ |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
828 append_proto_menu(menu, |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
829 gaim_account_get_connection(gaim_buddy_get_account(buddy)), |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
830 (GaimBlistNode*)buddy); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
831 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
832 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
833 static void |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
834 append_extended_menu(GntMenu *menu, GaimBlistNode *node) |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
835 { |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
836 GList *iter; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
837 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
838 for (iter = gaim_blist_node_get_extended_menu(node); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
839 iter; iter = g_list_delete_link(iter, iter)) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
840 { |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
841 gnt_append_menu_action(menu, iter->data, NULL); |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
842 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
843 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
844 |
14694
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
845 /* Xerox'd from gtkdialogs.c:gaim_gtkdialogs_remove_contact_cb */ |
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
846 static void |
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
847 remove_contact(GaimContact *contact) |
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
848 { |
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
849 GaimBlistNode *bnode, *cnode; |
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
850 GaimGroup *group; |
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
851 |
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
852 cnode = (GaimBlistNode *)contact; |
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
853 group = (GaimGroup*)cnode->parent; |
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
854 for (bnode = cnode->child; bnode; bnode = bnode->next) { |
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
855 GaimBuddy *buddy = (GaimBuddy*)bnode; |
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
856 if (gaim_account_is_connected(buddy->account)) |
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
857 gaim_account_remove_buddy(buddy->account, buddy, group); |
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
858 } |
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
859 gaim_blist_remove_contact(contact); |
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
860 } |
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
861 |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
862 static void |
14018
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
863 rename_blist_node(GaimBlistNode *node, const char *newname) |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
864 { |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
865 const char *name = newname; |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
866 if (name && !*name) |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
867 name = NULL; |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
868 |
14475
feedb7828791
[gaim-migrate @ 17191]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14470
diff
changeset
|
869 if (GAIM_BLIST_NODE_IS_CONTACT(node)) { |
feedb7828791
[gaim-migrate @ 17191]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14470
diff
changeset
|
870 GaimContact *contact = (GaimContact*)node; |
feedb7828791
[gaim-migrate @ 17191]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14470
diff
changeset
|
871 GaimBuddy *buddy = gaim_contact_get_priority_buddy(contact); |
feedb7828791
[gaim-migrate @ 17191]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14470
diff
changeset
|
872 gaim_blist_alias_contact(contact, name); |
feedb7828791
[gaim-migrate @ 17191]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14470
diff
changeset
|
873 gaim_blist_alias_buddy(buddy, name); |
feedb7828791
[gaim-migrate @ 17191]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14470
diff
changeset
|
874 serv_alias_buddy(buddy); |
feedb7828791
[gaim-migrate @ 17191]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14470
diff
changeset
|
875 } else if (GAIM_BLIST_NODE_IS_BUDDY(node)) { |
14018
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
876 gaim_blist_alias_buddy((GaimBuddy*)node, name); |
14475
feedb7828791
[gaim-migrate @ 17191]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14470
diff
changeset
|
877 serv_alias_buddy((GaimBuddy*)node); |
feedb7828791
[gaim-migrate @ 17191]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14470
diff
changeset
|
878 } else if (GAIM_BLIST_NODE_IS_CHAT(node)) |
14018
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
879 gaim_blist_alias_chat((GaimChat*)node, name); |
14691 | 880 else if (GAIM_BLIST_NODE_IS_GROUP(node) && (name != NULL)) |
14018
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
881 gaim_blist_rename_group((GaimGroup*)node, name); |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
882 else |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
883 g_return_if_reached(); |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
884 } |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
885 |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
886 static void |
15502
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
887 gg_blist_pounce_node_cb(GaimBlistNode *node, GaimBlistNode *selected) |
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
888 { |
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
889 GaimBuddy *b; |
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
890 if (GAIM_BLIST_NODE_IS_CONTACT(node)) |
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
891 b = gaim_contact_get_priority_buddy((GaimContact *)node); |
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
892 else |
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
893 b = (GaimBuddy *)node; |
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
894 gg_pounce_editor_show(b->account, b->name, NULL); |
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
895 } |
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
896 |
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
897 static void |
14469
ddfe82afecd8
[gaim-migrate @ 17185]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14427
diff
changeset
|
898 gg_blist_rename_node_cb(GaimBlistNode *node, GaimBlistNode *selected) |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
899 { |
14018
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
900 const char *name = NULL; |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
901 char *prompt; |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
902 |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
903 if (GAIM_BLIST_NODE_IS_CONTACT(node)) |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
904 name = gaim_contact_get_alias((GaimContact*)node); |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
905 else if (GAIM_BLIST_NODE_IS_BUDDY(node)) |
14018
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
906 name = gaim_buddy_get_contact_alias((GaimBuddy*)node); |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
907 else if (GAIM_BLIST_NODE_IS_CHAT(node)) |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
908 name = gaim_chat_get_name((GaimChat*)node); |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
909 else if (GAIM_BLIST_NODE_IS_GROUP(node)) |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
910 name = ((GaimGroup*)node)->name; |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
911 else |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
912 g_return_if_reached(); |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
913 |
14018
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
914 prompt = g_strdup_printf(_("Please enter the new name for %s"), name); |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
915 |
14018
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
916 gaim_request_input(node, _("Rename"), prompt, _("Enter empty string to reset the name."), |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
917 name, FALSE, FALSE, NULL, _("Rename"), G_CALLBACK(rename_blist_node), |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
918 _("Cancel"), NULL, node); |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
919 |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
920 g_free(prompt); |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
921 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
922 |
14063
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
923 /* Xeroxed from gtkdialogs.c:gaim_gtkdialogs_remove_group_cb*/ |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
924 static void |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
925 remove_group(GaimGroup *group) |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
926 { |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
927 GaimBlistNode *cnode, *bnode; |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
928 |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
929 cnode = ((GaimBlistNode*)group)->child; |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
930 |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
931 while (cnode) { |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
932 if (GAIM_BLIST_NODE_IS_CONTACT(cnode)) { |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
933 bnode = cnode->child; |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
934 cnode = cnode->next; |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
935 while (bnode) { |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
936 GaimBuddy *buddy; |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
937 if (GAIM_BLIST_NODE_IS_BUDDY(bnode)) { |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
938 buddy = (GaimBuddy*)bnode; |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
939 bnode = bnode->next; |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
940 if (gaim_account_is_connected(buddy->account)) { |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
941 gaim_account_remove_buddy(buddy->account, buddy, group); |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
942 gaim_blist_remove_buddy(buddy); |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
943 } |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
944 } else { |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
945 bnode = bnode->next; |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
946 } |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
947 } |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
948 } else if (GAIM_BLIST_NODE_IS_CHAT(cnode)) { |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
949 GaimChat *chat = (GaimChat *)cnode; |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
950 cnode = cnode->next; |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
951 if (gaim_account_is_connected(chat->account)) |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
952 gaim_blist_remove_chat(chat); |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
953 } else { |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
954 cnode = cnode->next; |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
955 } |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
956 } |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
957 |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
958 gaim_blist_remove_group(group); |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
959 } |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
960 |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
961 static void |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
962 gg_blist_remove_node(GaimBlistNode *node) |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
963 { |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
964 if (GAIM_BLIST_NODE_IS_CONTACT(node)) { |
14694
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
965 remove_contact((GaimContact*)node); |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
966 } else if (GAIM_BLIST_NODE_IS_BUDDY(node)) { |
14063
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
967 GaimBuddy *buddy = (GaimBuddy*)node; |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
968 GaimGroup *group = gaim_buddy_get_group(buddy); |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
969 gaim_account_remove_buddy(gaim_buddy_get_account(buddy), buddy, group); |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
970 gaim_blist_remove_buddy(buddy); |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
971 } else if (GAIM_BLIST_NODE_IS_CHAT(node)) { |
14063
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
972 gaim_blist_remove_chat((GaimChat*)node); |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
973 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) { |
14063
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
974 remove_group((GaimGroup*)node); |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
975 } |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
976 } |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
977 |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
978 static void |
14469
ddfe82afecd8
[gaim-migrate @ 17185]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14427
diff
changeset
|
979 gg_blist_remove_node_cb(GaimBlistNode *node, GaimBlistNode *selected) |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
980 { |
14198
c65ed4f6eea8
[gaim-migrate @ 16870]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
981 char *primary; |
c65ed4f6eea8
[gaim-migrate @ 16870]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
982 const char *name, *sec = NULL; |
14064
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
983 |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
984 /* XXX: could be a contact */ |
14694
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
985 if (GAIM_BLIST_NODE_IS_CONTACT(node)) { |
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
986 GaimContact *c = (GaimContact*)node; |
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
987 name = gaim_contact_get_alias(c); |
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
988 if (c->totalsize > 1) |
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
989 sec = _("Removing this contact will also remove all the buddies in the contact"); |
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
990 } else if (GAIM_BLIST_NODE_IS_BUDDY(node)) |
14064
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
991 name = gaim_buddy_get_name((GaimBuddy*)node); |
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
992 else if (GAIM_BLIST_NODE_IS_CHAT(node)) |
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
993 name = gaim_chat_get_name((GaimChat*)node); |
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
994 else if (GAIM_BLIST_NODE_IS_GROUP(node)) |
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
995 { |
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
996 name = ((GaimGroup*)node)->name; |
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
997 sec = _("Removing this group will also remove all the buddies in the group"); |
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
998 } |
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
999 else |
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
1000 return; |
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
1001 |
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
1002 primary = g_strdup_printf(_("Are you sure you want to remove %s?"), name); |
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
1003 |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1004 /* XXX: anything to do with the returned ui-handle? */ |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1005 gaim_request_action(node, _("Confirm Remove"), |
14064
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
1006 primary, sec, |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1007 1, node, 2, |
14063
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
1008 _("Remove"), gg_blist_remove_node, |
14064
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
1009 _("Cancel"), NULL); |
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
1010 g_free(primary); |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1011 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1012 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1013 static void |
14977
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1014 gg_blist_toggle_tag_buddy(GaimBlistNode *node) |
14694
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
1015 { |
14977
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1016 GList *iter; |
15315
28051164843c
[gaim-migrate @ 18106]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15182
diff
changeset
|
1017 if (node == NULL) |
28051164843c
[gaim-migrate @ 18106]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15182
diff
changeset
|
1018 return; |
14984
fb98e9c45607
[gaim-migrate @ 17763]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14977
diff
changeset
|
1019 if (GAIM_BLIST_NODE_IS_CHAT(node) || GAIM_BLIST_NODE_IS_GROUP(node)) |
fb98e9c45607
[gaim-migrate @ 17763]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14977
diff
changeset
|
1020 return; |
14977
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1021 if (ggblist->tagged && (iter = g_list_find(ggblist->tagged, node)) != NULL) { |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1022 ggblist->tagged = g_list_delete_link(ggblist->tagged, iter); |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1023 } else { |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1024 ggblist->tagged = g_list_prepend(ggblist->tagged, node); |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1025 } |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1026 if (GAIM_BLIST_NODE_IS_CONTACT(node)) |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1027 node = (GaimBlistNode*)gaim_contact_get_priority_buddy((GaimContact*)node); |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1028 update_buddy_display((GaimBuddy*)node, ggblist); |
14694
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
1029 } |
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
1030 |
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
1031 static void |
14977
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1032 gg_blist_place_tagged(GaimBlistNode *target) |
14694
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
1033 { |
14977
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1034 GaimGroup *tg = NULL; |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1035 GaimContact *tc = NULL; |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1036 |
15315
28051164843c
[gaim-migrate @ 18106]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15182
diff
changeset
|
1037 if (target == NULL) |
28051164843c
[gaim-migrate @ 18106]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15182
diff
changeset
|
1038 return; |
28051164843c
[gaim-migrate @ 18106]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15182
diff
changeset
|
1039 |
15021 | 1040 /* This target resolution probably needs more clarification; for |
1041 * example, if I tag a buddy in a contact, then place on | |
1042 * another buddy in the same contact, I probably intend to | |
1043 * place the tagged buddy immediately after (before?) the | |
1044 * target buddy -- this will simply move the tagged buddy | |
1045 * within the same contact without reference to position. */ | |
14977
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1046 if (GAIM_BLIST_NODE_IS_GROUP(target)) |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1047 tg = (GaimGroup*)target; |
15021 | 1048 else if (GAIM_BLIST_NODE_IS_CONTACT(target)) |
14977
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1049 tc = (GaimContact*)target; |
15021 | 1050 else /* Buddy or Chat */ |
1051 tc = (GaimContact*)target->parent; | |
14977
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1052 |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1053 if (ggblist->tagged) { |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1054 GList *list = ggblist->tagged; |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1055 ggblist->tagged = NULL; |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1056 |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1057 while (list) { |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1058 GaimBlistNode *node = list->data; |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1059 list = g_list_delete_link(list, list); |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1060 if (tg) { |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1061 if (GAIM_BLIST_NODE_IS_CONTACT(node)) |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1062 gaim_blist_add_contact((GaimContact*)node, tg, NULL); |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1063 else |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1064 gaim_blist_add_buddy((GaimBuddy*)node, NULL, tg, NULL); |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1065 } else { |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1066 if (GAIM_BLIST_NODE_IS_BUDDY(node)) |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1067 gaim_blist_add_buddy((GaimBuddy*)node, tc, |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1068 gaim_buddy_get_group(gaim_contact_get_priority_buddy(tc)), NULL); |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1069 else if (GAIM_BLIST_NODE_IS_CONTACT(node)) |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1070 gaim_blist_merge_contact((GaimContact*)node, target); |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1071 } |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1072 } |
14694
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
1073 } |
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
1074 } |
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
1075 |
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
1076 static void |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
1077 context_menu_destroyed(GntWidget *widget, GGBlist *ggblist) |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
1078 { |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
1079 ggblist->context = NULL; |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
1080 } |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
1081 |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
1082 static void |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1083 draw_context_menu(GGBlist *ggblist) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1084 { |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1085 GaimBlistNode *node = NULL; |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
1086 GntWidget *context = NULL; |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1087 GntTree *tree = NULL; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1088 int x, y, top, width; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1089 char *title = NULL; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1090 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1091 tree = GNT_TREE(ggblist->tree); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1092 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1093 node = gnt_tree_get_selection_data(tree); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1094 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1095 if (ggblist->tooltip) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1096 remove_tooltip(ggblist); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1097 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1098 ggblist->cnode = node; |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
1099 |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
1100 ggblist->context = context = gnt_menu_new(GNT_MENU_POPUP); |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
1101 g_signal_connect(G_OBJECT(context), "destroy", G_CALLBACK(context_menu_destroyed), ggblist); |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1102 |
14694
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
1103 if (!node) { |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
1104 create_group_menu(GNT_MENU(context), NULL); |
14694
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
1105 title = g_strdup(_("Buddy List")); |
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
1106 } else if (GAIM_BLIST_NODE_IS_CONTACT(node)) { |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
1107 create_buddy_menu(GNT_MENU(context), |
14385
d1e4e986bbd1
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14384
diff
changeset
|
1108 gaim_contact_get_priority_buddy((GaimContact*)node)); |
d1e4e986bbd1
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14384
diff
changeset
|
1109 title = g_strdup(gaim_contact_get_alias((GaimContact*)node)); |
d1e4e986bbd1
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14384
diff
changeset
|
1110 } else if (GAIM_BLIST_NODE_IS_BUDDY(node)) { |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1111 GaimBuddy *buddy = (GaimBuddy *)node; |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
1112 create_buddy_menu(GNT_MENU(context), buddy); |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1113 title = g_strdup(gaim_buddy_get_name(buddy)); |
14385
d1e4e986bbd1
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14384
diff
changeset
|
1114 } else if (GAIM_BLIST_NODE_IS_CHAT(node)) { |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1115 GaimChat *chat = (GaimChat*)node; |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
1116 create_chat_menu(GNT_MENU(context), chat); |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1117 title = g_strdup(gaim_chat_get_name(chat)); |
14385
d1e4e986bbd1
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14384
diff
changeset
|
1118 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) { |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1119 GaimGroup *group = (GaimGroup *)node; |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
1120 create_group_menu(GNT_MENU(context), group); |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1121 title = g_strdup(group->name); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1122 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1123 |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
1124 append_extended_menu(GNT_MENU(context), node); |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1125 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1126 /* These are common for everything */ |
14694
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
1127 if (node) { |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
1128 add_custom_action(GNT_MENU(context), _("Rename"), |
14694
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
1129 GAIM_CALLBACK(gg_blist_rename_node_cb), node); |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
1130 add_custom_action(GNT_MENU(context), _("Remove"), |
14694
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
1131 GAIM_CALLBACK(gg_blist_remove_node_cb), node); |
14977
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1132 |
14694
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
1133 if (ggblist->tagged && (GAIM_BLIST_NODE_IS_CONTACT(node) |
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
1134 || GAIM_BLIST_NODE_IS_GROUP(node))) { |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
1135 add_custom_action(GNT_MENU(context), _("Place tagged"), |
14694
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
1136 GAIM_CALLBACK(gg_blist_place_tagged), node); |
14977
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1137 } |
15502
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
1138 |
14977
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1139 if (GAIM_BLIST_NODE_IS_BUDDY(node) || GAIM_BLIST_NODE_IS_CONTACT(node)) { |
15502
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
1140 add_custom_action(GNT_MENU(context), _("Add Buddy Pounce"), |
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
1141 GAIM_CALLBACK(gg_blist_pounce_node_cb), node); |
14977
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1142 add_custom_action(GNT_MENU(context), _("Toggle Tag"), |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1143 GAIM_CALLBACK(gg_blist_toggle_tag_buddy), node); |
14694
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
1144 } |
8538993dbb00
[gaim-migrate @ 17446]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14691
diff
changeset
|
1145 } |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1146 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1147 /* Set the position for the popup */ |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1148 gnt_widget_get_position(GNT_WIDGET(tree), &x, &y); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1149 gnt_widget_get_size(GNT_WIDGET(tree), &width, NULL); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1150 top = gnt_tree_get_selection_visible_line(tree); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1151 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1152 x += width; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1153 y += top - 1; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1154 |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
1155 gnt_widget_set_position(context, x, y); |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
1156 gnt_screen_menu_show(GNT_MENU(context)); |
13959
2ae35c0cf616
[gaim-migrate @ 16511]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13958
diff
changeset
|
1157 g_free(title); |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1158 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1159 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1160 static void |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1161 tooltip_for_buddy(GaimBuddy *buddy, GString *str) |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1162 { |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1163 GaimPlugin *prpl; |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1164 GaimPluginProtocolInfo *prpl_info; |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1165 GaimAccount *account; |
15145
d308c7c6f669
[gaim-migrate @ 17931]
Evan Schoenberg <evan.s@dreskin.net>
parents:
15051
diff
changeset
|
1166 GaimNotifyUserInfo *user_info; |
15051
34e049e6ce10
[gaim-migrate @ 17835]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15021
diff
changeset
|
1167 const char *alias = gaim_buddy_get_alias(buddy); |
15145
d308c7c6f669
[gaim-migrate @ 17931]
Evan Schoenberg <evan.s@dreskin.net>
parents:
15051
diff
changeset
|
1168 char *tmp, *strip; |
d308c7c6f669
[gaim-migrate @ 17931]
Evan Schoenberg <evan.s@dreskin.net>
parents:
15051
diff
changeset
|
1169 |
d308c7c6f669
[gaim-migrate @ 17931]
Evan Schoenberg <evan.s@dreskin.net>
parents:
15051
diff
changeset
|
1170 user_info = gaim_notify_user_info_new(); |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1171 |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1172 account = gaim_buddy_get_account(buddy); |
15051
34e049e6ce10
[gaim-migrate @ 17835]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15021
diff
changeset
|
1173 |
34e049e6ce10
[gaim-migrate @ 17835]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15021
diff
changeset
|
1174 if (g_utf8_collate(gaim_buddy_get_name(buddy), alias)) |
15145
d308c7c6f669
[gaim-migrate @ 17931]
Evan Schoenberg <evan.s@dreskin.net>
parents:
15051
diff
changeset
|
1175 gaim_notify_user_info_add_pair(user_info, _("Nickname"), alias); |
d308c7c6f669
[gaim-migrate @ 17931]
Evan Schoenberg <evan.s@dreskin.net>
parents:
15051
diff
changeset
|
1176 |
d308c7c6f669
[gaim-migrate @ 17931]
Evan Schoenberg <evan.s@dreskin.net>
parents:
15051
diff
changeset
|
1177 tmp = g_strdup_printf("%s (%s)", |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1178 gaim_account_get_username(account), |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1179 gaim_account_get_protocol_name(account)); |
15145
d308c7c6f669
[gaim-migrate @ 17931]
Evan Schoenberg <evan.s@dreskin.net>
parents:
15051
diff
changeset
|
1180 gaim_notify_user_info_add_pair(user_info, _("Account"), tmp); |
d308c7c6f669
[gaim-migrate @ 17931]
Evan Schoenberg <evan.s@dreskin.net>
parents:
15051
diff
changeset
|
1181 g_free(tmp); |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1182 |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1183 prpl = gaim_find_prpl(gaim_account_get_protocol_id(account)); |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1184 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl); |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1185 if (prpl_info && prpl_info->tooltip_text) { |
15145
d308c7c6f669
[gaim-migrate @ 17931]
Evan Schoenberg <evan.s@dreskin.net>
parents:
15051
diff
changeset
|
1186 prpl_info->tooltip_text(buddy, user_info, TRUE); |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1187 } |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1188 |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1189 if (gaim_prefs_get_bool("/gaim/gnt/blist/idletime")) { |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1190 GaimPresence *pre = gaim_buddy_get_presence(buddy); |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1191 if (gaim_presence_is_idle(pre)) { |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1192 time_t idle = gaim_presence_get_idle_time(pre); |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1193 if (idle > 0) { |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1194 char *st = gaim_str_seconds_to_string(time(NULL) - idle); |
15145
d308c7c6f669
[gaim-migrate @ 17931]
Evan Schoenberg <evan.s@dreskin.net>
parents:
15051
diff
changeset
|
1195 gaim_notify_user_info_add_pair(user_info, _("Idle"), st); |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1196 g_free(st); |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1197 } |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1198 } |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1199 } |
15145
d308c7c6f669
[gaim-migrate @ 17931]
Evan Schoenberg <evan.s@dreskin.net>
parents:
15051
diff
changeset
|
1200 |
15179
6c43dbf293ad
[gaim-migrate @ 17966]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15166
diff
changeset
|
1201 tmp = gaim_notify_user_info_get_text_with_newline(user_info, "<BR>"); |
15145
d308c7c6f669
[gaim-migrate @ 17931]
Evan Schoenberg <evan.s@dreskin.net>
parents:
15051
diff
changeset
|
1202 gaim_notify_user_info_destroy(user_info); |
d308c7c6f669
[gaim-migrate @ 17931]
Evan Schoenberg <evan.s@dreskin.net>
parents:
15051
diff
changeset
|
1203 |
d308c7c6f669
[gaim-migrate @ 17931]
Evan Schoenberg <evan.s@dreskin.net>
parents:
15051
diff
changeset
|
1204 strip = gaim_markup_strip_html(tmp); |
d308c7c6f669
[gaim-migrate @ 17931]
Evan Schoenberg <evan.s@dreskin.net>
parents:
15051
diff
changeset
|
1205 g_string_append(str, strip); |
d308c7c6f669
[gaim-migrate @ 17931]
Evan Schoenberg <evan.s@dreskin.net>
parents:
15051
diff
changeset
|
1206 g_free(strip); |
d308c7c6f669
[gaim-migrate @ 17931]
Evan Schoenberg <evan.s@dreskin.net>
parents:
15051
diff
changeset
|
1207 g_free(tmp); |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1208 } |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1209 |
14935
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1210 static GString* |
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1211 make_sure_text_fits(GString *string) |
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1212 { |
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1213 int maxw = getmaxx(stdscr) - 3; |
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1214 char *str = gnt_util_onscreen_fit_string(string->str, maxw); |
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1215 string = g_string_assign(string, str); |
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1216 g_free(str); |
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1217 return string; |
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1218 } |
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1219 |
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1220 static gboolean |
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1221 draw_tooltip_real(GGBlist *ggblist) |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1222 { |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1223 GaimBlistNode *node; |
14935
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1224 int x, y, top, width, w, h; |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1225 GString *str; |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
1226 GntTree *tree; |
14935
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1227 GntWidget *widget, *box, *tv; |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
1228 char *title = NULL; |
14427
1e00e8245720
[gaim-migrate @ 17137]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14407
diff
changeset
|
1229 int lastseen = 0; |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
1230 |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
1231 widget = ggblist->tree; |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
1232 tree = GNT_TREE(widget); |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1233 |
14919
056c8a27668c
[gaim-migrate @ 17691]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14889
diff
changeset
|
1234 if (!gnt_widget_has_focus(ggblist->tree) || |
056c8a27668c
[gaim-migrate @ 17691]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14889
diff
changeset
|
1235 (ggblist->context && !GNT_WIDGET_IS_FLAG_SET(ggblist->context, GNT_WIDGET_INVISIBLE))) |
14935
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1236 return FALSE; |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
1237 |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1238 if (ggblist->tooltip) |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1239 { |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13865
diff
changeset
|
1240 /* XXX: Once we can properly redraw on expose events, this can be removed at the end |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13865
diff
changeset
|
1241 * to avoid the blinking*/ |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1242 remove_tooltip(ggblist); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1243 } |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1244 |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1245 node = gnt_tree_get_selection_data(tree); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1246 if (!node) |
14935
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1247 return FALSE; |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1248 |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1249 str = g_string_new(""); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1250 |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1251 if (GAIM_BLIST_NODE_IS_CONTACT(node)) { |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1252 GaimBuddy *pr = gaim_contact_get_priority_buddy((GaimContact*)node); |
14427
1e00e8245720
[gaim-migrate @ 17137]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14407
diff
changeset
|
1253 gboolean offline = !GAIM_BUDDY_IS_ONLINE(pr); |
1e00e8245720
[gaim-migrate @ 17137]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14407
diff
changeset
|
1254 gboolean showoffline = gaim_prefs_get_bool(PREF_ROOT "/showoffline"); |
14919
056c8a27668c
[gaim-migrate @ 17691]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14889
diff
changeset
|
1255 const char *name = gaim_buddy_get_name(pr); |
14427
1e00e8245720
[gaim-migrate @ 17137]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14407
diff
changeset
|
1256 |
15051
34e049e6ce10
[gaim-migrate @ 17835]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15021
diff
changeset
|
1257 title = g_strdup(name); |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1258 tooltip_for_buddy(pr, str); |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1259 for (node = node->child; node; node = node->next) { |
14935
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1260 GaimBuddy *buddy = (GaimBuddy*)node; |
14427
1e00e8245720
[gaim-migrate @ 17137]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14407
diff
changeset
|
1261 if (offline) { |
1e00e8245720
[gaim-migrate @ 17137]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14407
diff
changeset
|
1262 int value = gaim_blist_node_get_int(node, "last_seen"); |
1e00e8245720
[gaim-migrate @ 17137]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14407
diff
changeset
|
1263 if (value > lastseen) |
1e00e8245720
[gaim-migrate @ 17137]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14407
diff
changeset
|
1264 lastseen = value; |
1e00e8245720
[gaim-migrate @ 17137]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14407
diff
changeset
|
1265 } |
1e00e8245720
[gaim-migrate @ 17137]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14407
diff
changeset
|
1266 if (node == (GaimBlistNode*)pr) |
1e00e8245720
[gaim-migrate @ 17137]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14407
diff
changeset
|
1267 continue; |
14935
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1268 if (!gaim_account_is_connected(buddy->account)) |
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1269 continue; |
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1270 if (!showoffline && !GAIM_BUDDY_IS_ONLINE(buddy)) |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1271 continue; |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1272 str = g_string_append(str, "\n----------\n"); |
14935
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1273 tooltip_for_buddy(buddy, str); |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1274 } |
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1275 } else if (GAIM_BLIST_NODE_IS_BUDDY(node)) { |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1276 GaimBuddy *buddy = (GaimBuddy *)node; |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1277 tooltip_for_buddy(buddy, str); |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1278 title = g_strdup(gaim_buddy_get_name(buddy)); |
14427
1e00e8245720
[gaim-migrate @ 17137]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14407
diff
changeset
|
1279 if (!GAIM_BUDDY_IS_ONLINE((GaimBuddy*)node)) |
1e00e8245720
[gaim-migrate @ 17137]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14407
diff
changeset
|
1280 lastseen = gaim_blist_node_get_int(node, "last_seen"); |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1281 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) { |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
1282 GaimGroup *group = (GaimGroup *)node; |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
1283 |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
1284 g_string_append_printf(str, _("Online: %d\nTotal: %d"), |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
1285 gaim_blist_get_group_online_count(group), |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
1286 gaim_blist_get_group_size(group, FALSE)); |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
1287 |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
1288 title = g_strdup(group->name); |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1289 } else if (GAIM_BLIST_NODE_IS_CHAT(node)) { |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
1290 GaimChat *chat = (GaimChat *)node; |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
1291 GaimAccount *account = chat->account; |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
1292 |
13952
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
1293 g_string_append_printf(str, _("Account: %s (%s)"), |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
1294 gaim_account_get_username(account), |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
1295 gaim_account_get_protocol_name(account)); |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
1296 |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
1297 title = g_strdup(gaim_chat_get_name(chat)); |
14384
4a901f5d1312
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14379
diff
changeset
|
1298 } else { |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1299 g_string_free(str, TRUE); |
14935
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1300 return FALSE; |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1301 } |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1302 |
14427
1e00e8245720
[gaim-migrate @ 17137]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14407
diff
changeset
|
1303 if (lastseen > 0) { |
1e00e8245720
[gaim-migrate @ 17137]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14407
diff
changeset
|
1304 char *tmp = gaim_str_seconds_to_string(time(NULL) - lastseen); |
1e00e8245720
[gaim-migrate @ 17137]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14407
diff
changeset
|
1305 g_string_append_printf(str, _("\nLast Seen: %s ago"), tmp); |
1e00e8245720
[gaim-migrate @ 17137]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14407
diff
changeset
|
1306 g_free(tmp); |
1e00e8245720
[gaim-migrate @ 17137]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14407
diff
changeset
|
1307 } |
1e00e8245720
[gaim-migrate @ 17137]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14407
diff
changeset
|
1308 |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1309 gnt_widget_get_position(widget, &x, &y); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1310 gnt_widget_get_size(widget, &width, NULL); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1311 top = gnt_tree_get_selection_visible_line(tree); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1312 |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1313 x += width; |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1314 y += top - 1; |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1315 |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1316 box = gnt_box_new(FALSE, FALSE); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1317 gnt_box_set_toplevel(GNT_BOX(box), TRUE); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1318 GNT_WIDGET_SET_FLAGS(box, GNT_WIDGET_NO_SHADOW); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1319 gnt_box_set_title(GNT_BOX(box), title); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1320 |
14935
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1321 str = make_sure_text_fits(str); |
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1322 gnt_util_get_text_bound(str->str, &w, &h); |
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1323 h = MAX(2, h); |
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1324 tv = gnt_text_view_new(); |
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1325 gnt_widget_set_size(tv, w + 1, h); |
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1326 gnt_box_add_widget(GNT_BOX(box), tv); |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1327 |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1328 gnt_widget_set_position(box, x, y); |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
1329 GNT_WIDGET_UNSET_FLAGS(box, GNT_WIDGET_CAN_TAKE_FOCUS); |
14042
143474e2b1cb
[gaim-migrate @ 16648]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14041
diff
changeset
|
1330 GNT_WIDGET_SET_FLAGS(box, GNT_WIDGET_TRANSIENT); |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1331 gnt_widget_draw(box); |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
1332 |
14935
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1333 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(tv), str->str, GNT_TEXT_FLAG_NORMAL); |
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1334 gnt_text_view_scroll(GNT_TEXT_VIEW(tv), 0); |
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1335 |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
1336 g_free(title); |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1337 g_string_free(str, TRUE); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1338 ggblist->tooltip = box; |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1339 ggblist->tnode = node; |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13865
diff
changeset
|
1340 |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13865
diff
changeset
|
1341 gnt_widget_set_name(ggblist->tooltip, "tooltip"); |
14935
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1342 return FALSE; |
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1343 } |
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1344 |
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1345 static void |
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1346 draw_tooltip(GGBlist *ggblist) |
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1347 { |
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1348 /* When an account has signed off, it removes one buddy at a time. |
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1349 * Drawing the tooltip after removing each buddy is expensive. On |
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1350 * top of that, if the selected buddy belongs to the disconnected |
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1351 * account, then retreiving the tooltip for that causes crash. So |
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1352 * let's make sure we wait for all the buddies to be removed first.*/ |
14977
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1353 int id = g_timeout_add(0, (GSourceFunc)draw_tooltip_real, ggblist); |
14935
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1354 g_object_set_data_full(G_OBJECT(ggblist->window), "draw_tooltip_calback", |
ef80d4c30a90
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14919
diff
changeset
|
1355 GINT_TO_POINTER(id), (GDestroyNotify)g_source_remove); |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1356 } |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1357 |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
1358 static void |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
1359 selection_changed(GntWidget *widget, gpointer old, gpointer current, GGBlist *ggblist) |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
1360 { |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
1361 draw_tooltip(ggblist); |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
1362 } |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
1363 |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1364 static gboolean |
14834
52022b0a9405
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14712
diff
changeset
|
1365 context_menu(GntWidget *widget, GGBlist *ggblist) |
52022b0a9405
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14712
diff
changeset
|
1366 { |
52022b0a9405
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14712
diff
changeset
|
1367 draw_context_menu(ggblist); |
52022b0a9405
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14712
diff
changeset
|
1368 return TRUE; |
52022b0a9405
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14712
diff
changeset
|
1369 } |
52022b0a9405
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14712
diff
changeset
|
1370 |
52022b0a9405
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14712
diff
changeset
|
1371 static gboolean |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1372 key_pressed(GntWidget *widget, const char *text, GGBlist *ggblist) |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1373 { |
14977
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1374 if (text[0] == 27 && text[1] == 0) { |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1375 /* Escape was pressed */ |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1376 remove_peripherals(ggblist); |
14977
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1377 } else if (strcmp(text, GNT_KEY_CTRL_O) == 0) { |
14405
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14399
diff
changeset
|
1378 gaim_prefs_set_bool(PREF_ROOT "/showoffline", |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14399
diff
changeset
|
1379 !gaim_prefs_get_bool(PREF_ROOT "/showoffline")); |
15160
c6b79e535eb8
[gaim-migrate @ 17946]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15145
diff
changeset
|
1380 } else if (GNT_TREE(ggblist->tree)->search == NULL) { |
c6b79e535eb8
[gaim-migrate @ 17946]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15145
diff
changeset
|
1381 if (strcmp(text, "t") == 0) { |
c6b79e535eb8
[gaim-migrate @ 17946]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15145
diff
changeset
|
1382 gg_blist_toggle_tag_buddy(gnt_tree_get_selection_data(GNT_TREE(ggblist->tree))); |
c6b79e535eb8
[gaim-migrate @ 17946]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15145
diff
changeset
|
1383 gnt_bindable_perform_action_named(GNT_BINDABLE(ggblist->tree), "move-down"); |
c6b79e535eb8
[gaim-migrate @ 17946]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15145
diff
changeset
|
1384 } else if (strcmp(text, "a") == 0) { |
c6b79e535eb8
[gaim-migrate @ 17946]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15145
diff
changeset
|
1385 gg_blist_place_tagged(gnt_tree_get_selection_data(GNT_TREE(ggblist->tree))); |
15166
1bcf37440a05
[gaim-migrate @ 17952]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15160
diff
changeset
|
1386 } else |
1bcf37440a05
[gaim-migrate @ 17952]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15160
diff
changeset
|
1387 return FALSE; |
14977
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1388 } else |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1389 return FALSE; |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13884
diff
changeset
|
1390 |
14977
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1391 return TRUE; |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1392 } |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1393 |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
1394 static void |
13931
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1395 update_buddy_display(GaimBuddy *buddy, GGBlist *ggblist) |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
1396 { |
14385
d1e4e986bbd1
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14384
diff
changeset
|
1397 GaimContact *contact; |
14977
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1398 GntTextFormatFlags bflag = 0, cflag = 0; |
14385
d1e4e986bbd1
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14384
diff
changeset
|
1399 |
d1e4e986bbd1
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14384
diff
changeset
|
1400 contact = gaim_buddy_get_contact(buddy); |
d1e4e986bbd1
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14384
diff
changeset
|
1401 |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13959
diff
changeset
|
1402 gnt_tree_change_text(GNT_TREE(ggblist->tree), buddy, 0, get_display_name((GaimBlistNode*)buddy)); |
14385
d1e4e986bbd1
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14384
diff
changeset
|
1403 gnt_tree_change_text(GNT_TREE(ggblist->tree), contact, 0, get_display_name((GaimBlistNode*)contact)); |
d1e4e986bbd1
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14384
diff
changeset
|
1404 |
14977
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1405 if (ggblist->tagged && g_list_find(ggblist->tagged, buddy)) |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1406 bflag |= GNT_TEXT_FLAG_BOLD; |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1407 if (ggblist->tagged && g_list_find(ggblist->tagged, contact)) |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1408 cflag |= GNT_TEXT_FLAG_BOLD; |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1409 |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
1410 if (ggblist->tnode == (GaimBlistNode*)buddy) |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
1411 draw_tooltip(ggblist); |
13931
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1412 |
14385
d1e4e986bbd1
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14384
diff
changeset
|
1413 if (gaim_presence_is_idle(gaim_buddy_get_presence(buddy))) { |
14977
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1414 gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), buddy, bflag | GNT_TEXT_FLAG_DIM); |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1415 gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), contact, cflag | GNT_TEXT_FLAG_DIM); |
14385
d1e4e986bbd1
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14384
diff
changeset
|
1416 } else { |
14977
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1417 gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), buddy, bflag); |
e601bc7880a6
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14935
diff
changeset
|
1418 gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), contact, cflag); |
14385
d1e4e986bbd1
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14384
diff
changeset
|
1419 } |
13931
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1420 } |
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1421 |
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1422 static void |
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1423 buddy_status_changed(GaimBuddy *buddy, GaimStatus *old, GaimStatus *now, GGBlist *ggblist) |
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1424 { |
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1425 update_buddy_display(buddy, ggblist); |
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1426 } |
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1427 |
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1428 static void |
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1429 buddy_idle_changed(GaimBuddy *buddy, int old, int new, GGBlist *ggblist) |
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1430 { |
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1431 update_buddy_display(buddy, ggblist); |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
1432 } |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
1433 |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1434 static void |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1435 remove_peripherals(GGBlist *ggblist) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1436 { |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1437 if (ggblist->tooltip) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1438 remove_tooltip(ggblist); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1439 else if (ggblist->context) |
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14834
diff
changeset
|
1440 gnt_widget_destroy(ggblist->context); |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1441 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1442 |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1443 static void |
14846
c7651586e27b
[gaim-migrate @ 17615]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14843
diff
changeset
|
1444 size_changed_cb(GntWidget *w, int wi, int h) |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1445 { |
14846
c7651586e27b
[gaim-migrate @ 17615]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14843
diff
changeset
|
1446 int width, height; |
c7651586e27b
[gaim-migrate @ 17615]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14843
diff
changeset
|
1447 gnt_widget_get_size(w, &width, &height); |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1448 gaim_prefs_set_int(PREF_ROOT "/size/width", width); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1449 gaim_prefs_set_int(PREF_ROOT "/size/height", height); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1450 } |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1451 |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1452 static void |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1453 save_position_cb(GntWidget *w, int x, int y) |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1454 { |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1455 gaim_prefs_set_int(PREF_ROOT "/position/x", x); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1456 gaim_prefs_set_int(PREF_ROOT "/position/y", y); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1457 } |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1458 |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1459 static void |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1460 reset_blist_window(GntWidget *window, gpointer null) |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1461 { |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1462 GaimBlistNode *node; |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1463 gaim_signals_disconnect_by_handle(gg_blist_get_handle()); |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1464 gaim_get_blist()->ui_data = NULL; |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1465 |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1466 node = gaim_blist_get_root(); |
14399
28baa42b5ac2
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
1467 while (node) { |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1468 node->ui_data = NULL; |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1469 node = gaim_blist_node_next(node, TRUE); |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1470 } |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1471 |
14351
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
1472 if (ggblist->typing) |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
1473 g_source_remove(ggblist->typing); |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1474 remove_peripherals(ggblist); |
14984
fb98e9c45607
[gaim-migrate @ 17763]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14977
diff
changeset
|
1475 if (ggblist->tagged) |
fb98e9c45607
[gaim-migrate @ 17763]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14977
diff
changeset
|
1476 g_list_free(ggblist->tagged); |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1477 g_free(ggblist); |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1478 ggblist = NULL; |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1479 } |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1480 |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1481 static void |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1482 populate_buddylist() |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1483 { |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1484 GaimBlistNode *node; |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1485 GaimBuddyList *list; |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1486 |
14712
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1487 if (strcmp(gaim_prefs_get_string(PREF_ROOT "/sort_type"), "text") == 0) { |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1488 gnt_tree_set_compare_func(GNT_TREE(ggblist->tree), |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1489 (GCompareFunc)blist_node_compare_text); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1490 } else if (strcmp(gaim_prefs_get_string(PREF_ROOT "/sort_type"), "status") == 0) { |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1491 gnt_tree_set_compare_func(GNT_TREE(ggblist->tree), |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1492 (GCompareFunc)blist_node_compare_status); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1493 } else if (strcmp(gaim_prefs_get_string(PREF_ROOT "/sort_type"), "log") == 0) { |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1494 gnt_tree_set_compare_func(GNT_TREE(ggblist->tree), |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1495 (GCompareFunc)blist_node_compare_log); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1496 } |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1497 |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1498 list = gaim_get_blist(); |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1499 node = gaim_blist_get_root(); |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1500 while (node) |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1501 { |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1502 node_update(list, node); |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1503 node = gaim_blist_node_next(node, FALSE); |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1504 } |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1505 } |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1506 |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1507 static void |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1508 destroy_status_list(GList *list) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1509 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1510 g_list_foreach(list, (GFunc)g_free, NULL); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1511 g_list_free(list); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1512 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1513 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1514 static void |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1515 populate_status_dropdown() |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1516 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1517 int i; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1518 GList *iter; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1519 GList *items = NULL; |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
1520 StatusBoxItem *item = NULL; |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1521 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1522 /* First the primitives */ |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1523 GaimStatusPrimitive prims[] = {GAIM_STATUS_AVAILABLE, GAIM_STATUS_AWAY, |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1524 GAIM_STATUS_INVISIBLE, GAIM_STATUS_OFFLINE, GAIM_STATUS_UNSET}; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1525 |
14493
5ac8f22e7b08
[gaim-migrate @ 17212]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14477
diff
changeset
|
1526 gnt_combo_box_remove_all(GNT_COMBO_BOX(ggblist->status)); |
5ac8f22e7b08
[gaim-migrate @ 17212]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14477
diff
changeset
|
1527 |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1528 for (i = 0; prims[i] != GAIM_STATUS_UNSET; i++) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1529 { |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
1530 item = g_new0(StatusBoxItem, 1); |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1531 item->type = STATUS_PRIMITIVE; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1532 item->u.prim = prims[i]; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1533 items = g_list_prepend(items, item); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1534 gnt_combo_box_add_data(GNT_COMBO_BOX(ggblist->status), item, |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1535 gaim_primitive_get_name_from_type(prims[i])); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1536 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1537 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1538 /* Now the popular statuses */ |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1539 for (iter = gaim_savedstatuses_get_popular(6); iter; iter = iter->next) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1540 { |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
1541 item = g_new0(StatusBoxItem, 1); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
1542 item->type = STATUS_SAVED_POPULAR; |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1543 item->u.saved = iter->data; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1544 items = g_list_prepend(items, item); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1545 gnt_combo_box_add_data(GNT_COMBO_BOX(ggblist->status), item, |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1546 gaim_savedstatus_get_title(iter->data)); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1547 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1548 |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
1549 /* New savedstatus */ |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
1550 item = g_new0(StatusBoxItem, 1); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
1551 item->type = STATUS_SAVED_NEW; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
1552 items = g_list_prepend(items, item); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
1553 gnt_combo_box_add_data(GNT_COMBO_BOX(ggblist->status), item, |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
1554 _("New...")); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
1555 |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
1556 /* More savedstatuses */ |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
1557 item = g_new0(StatusBoxItem, 1); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
1558 item->type = STATUS_SAVED_ALL; |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
1559 items = g_list_prepend(items, item); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
1560 gnt_combo_box_add_data(GNT_COMBO_BOX(ggblist->status), item, |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
1561 _("Saved...")); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
1562 |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1563 /* The keys for the combobox are created here, and never used |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1564 * anywhere else. So make sure the keys are freed when the widget |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1565 * is destroyed. */ |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
1566 g_object_set_data_full(G_OBJECT(ggblist->status), "list of statuses", |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
1567 items, (GDestroyNotify)destroy_status_list); |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1568 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1569 |
14399
28baa42b5ac2
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
1570 static void |
28baa42b5ac2
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
1571 redraw_blist(const char *name, GaimPrefType type, gconstpointer val, gpointer data) |
28baa42b5ac2
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
1572 { |
14469
ddfe82afecd8
[gaim-migrate @ 17185]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14427
diff
changeset
|
1573 GaimBlistNode *node, *sel; |
14848
6d9db29f4c10
[gaim-migrate @ 17617]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14847
diff
changeset
|
1574 if (ggblist == NULL || ggblist->window == NULL) |
14399
28baa42b5ac2
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
1575 return; |
28baa42b5ac2
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
1576 |
14469
ddfe82afecd8
[gaim-migrate @ 17185]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14427
diff
changeset
|
1577 sel = gnt_tree_get_selection_data(GNT_TREE(ggblist->tree)); |
14399
28baa42b5ac2
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
1578 gnt_tree_remove_all(GNT_TREE(ggblist->tree)); |
28baa42b5ac2
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
1579 node = gaim_blist_get_root(); |
28baa42b5ac2
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
1580 for (; node; node = gaim_blist_node_next(node, TRUE)) |
28baa42b5ac2
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
1581 node->ui_data = NULL; |
28baa42b5ac2
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
1582 populate_buddylist(); |
14469
ddfe82afecd8
[gaim-migrate @ 17185]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14427
diff
changeset
|
1583 gnt_tree_set_selected(GNT_TREE(ggblist->tree), sel); |
ddfe82afecd8
[gaim-migrate @ 17185]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14427
diff
changeset
|
1584 draw_tooltip(ggblist); |
14399
28baa42b5ac2
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
1585 } |
28baa42b5ac2
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
1586 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1587 void gg_blist_init() |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1588 { |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1589 gaim_prefs_add_none(PREF_ROOT); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1590 gaim_prefs_add_none(PREF_ROOT "/size"); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1591 gaim_prefs_add_int(PREF_ROOT "/size/width", 20); |
14218 | 1592 gaim_prefs_add_int(PREF_ROOT "/size/height", 17); |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1593 gaim_prefs_add_none(PREF_ROOT "/position"); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1594 gaim_prefs_add_int(PREF_ROOT "/position/x", 0); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1595 gaim_prefs_add_int(PREF_ROOT "/position/y", 0); |
14399
28baa42b5ac2
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
1596 gaim_prefs_add_bool(PREF_ROOT "/idletime", TRUE); |
28baa42b5ac2
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
1597 gaim_prefs_add_bool(PREF_ROOT "/showoffline", FALSE); |
14712
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1598 gaim_prefs_add_string(PREF_ROOT "/sort_type", "text"); |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1599 |
14399
28baa42b5ac2
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
1600 gaim_prefs_connect_callback(gg_blist_get_handle(), |
28baa42b5ac2
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
1601 PREF_ROOT "/showoffline", redraw_blist, NULL); |
14712
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1602 gaim_prefs_connect_callback(gg_blist_get_handle(), |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1603 PREF_ROOT "/sort_type", redraw_blist, NULL); |
14399
28baa42b5ac2
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
1604 |
15180
4b500bd49d38
[gaim-migrate @ 17967]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15179
diff
changeset
|
1605 gaim_signal_connect(gaim_connections_get_handle(), "signed-on", gaim_blist_get_handle(), |
4b500bd49d38
[gaim-migrate @ 17967]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15179
diff
changeset
|
1606 G_CALLBACK(account_signed_on_cb), NULL); |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1607 return; |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1608 } |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1609 |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14042
diff
changeset
|
1610 static gboolean |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1611 remove_typing_cb(gpointer null) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1612 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1613 GaimSavedStatus *current; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1614 const char *message, *newmessage; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1615 GaimStatusPrimitive prim, newprim; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1616 StatusBoxItem *item; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1617 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1618 current = gaim_savedstatus_get_current(); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1619 message = gaim_savedstatus_get_message(current); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1620 prim = gaim_savedstatus_get_type(current); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1621 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1622 newmessage = gnt_entry_get_text(GNT_ENTRY(ggblist->statustext)); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1623 item = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(ggblist->status)); |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14042
diff
changeset
|
1624 g_return_val_if_fail(item->type == STATUS_PRIMITIVE, FALSE); |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1625 newprim = item->u.prim; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1626 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1627 if (newprim != prim || ((message && !newmessage) || |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1628 (!message && newmessage) || |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1629 (message && newmessage && g_utf8_collate(message, newmessage) != 0))) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1630 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1631 GaimSavedStatus *status = gaim_savedstatus_find_transient_by_type_and_message(newprim, newmessage); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1632 /* Holy Crap! That's a LAWNG function name */ |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1633 if (status == NULL) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1634 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1635 status = gaim_savedstatus_new(NULL, newprim); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1636 gaim_savedstatus_set_message(status, newmessage); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1637 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1638 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1639 gaim_savedstatus_activate(status); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1640 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1641 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1642 gnt_box_give_focus_to_child(GNT_BOX(ggblist->window), ggblist->tree); |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
1643 if (ggblist->typing) |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
1644 g_source_remove(ggblist->typing); |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1645 ggblist->typing = 0; |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14042
diff
changeset
|
1646 return FALSE; |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1647 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1648 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1649 static void |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1650 status_selection_changed(GntComboBox *box, StatusBoxItem *old, StatusBoxItem *now, gpointer null) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1651 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1652 gnt_entry_set_text(GNT_ENTRY(ggblist->statustext), NULL); |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
1653 if (now->type == STATUS_SAVED_POPULAR) |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1654 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1655 /* Set the status immediately */ |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1656 gaim_savedstatus_activate(now->u.saved); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1657 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1658 else if (now->type == STATUS_PRIMITIVE) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1659 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1660 /* Move the focus to the entry box */ |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
1661 /* XXX: Make sure the selected status can have a message */ |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1662 gnt_box_move_focus(GNT_BOX(ggblist->window), 1); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1663 ggblist->typing = g_timeout_add(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, NULL); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1664 } |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
1665 else if (now->type == STATUS_SAVED_ALL) |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
1666 { |
14131
db2311999862
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
1667 /* Restore the selection to reflect current status. */ |
db2311999862
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
1668 savedstatus_changed(gaim_savedstatus_get_current(), NULL); |
db2311999862
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
1669 gnt_box_give_focus_to_child(GNT_BOX(ggblist->window), ggblist->tree); |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
1670 gg_savedstatus_show_all(); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
1671 } |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
1672 else if (now->type == STATUS_SAVED_NEW) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
1673 { |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
1674 savedstatus_changed(gaim_savedstatus_get_current(), NULL); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
1675 gnt_box_give_focus_to_child(GNT_BOX(ggblist->window), ggblist->tree); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
1676 gg_savedstatus_edit(NULL); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
1677 } |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1678 else |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1679 g_return_if_reached(); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1680 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1681 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1682 static gboolean |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1683 status_text_changed(GntEntry *entry, const char *text, gpointer null) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1684 { |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14042
diff
changeset
|
1685 if ((text[0] == 27 || (text[0] == '\t' && text[1] == '\0')) && ggblist->typing == 0) |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1686 return FALSE; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1687 |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
1688 if (ggblist->typing) |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
1689 g_source_remove(ggblist->typing); |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1690 ggblist->typing = 0; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1691 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1692 if (text[0] == '\r' && text[1] == 0) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1693 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1694 /* Set the status only after you press 'Enter' */ |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1695 remove_typing_cb(NULL); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1696 return TRUE; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1697 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1698 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1699 ggblist->typing = g_timeout_add(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, NULL); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1700 return FALSE; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1701 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1702 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1703 static void |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1704 savedstatus_changed(GaimSavedStatus *now, GaimSavedStatus *old) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1705 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1706 GList *list; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1707 GaimStatusPrimitive prim; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1708 const char *message; |
15502
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
1709 gboolean found = FALSE, saved = TRUE; |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1710 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1711 if (!ggblist) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1712 return; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1713 |
14493
5ac8f22e7b08
[gaim-migrate @ 17212]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14477
diff
changeset
|
1714 /* Block the signals we don't want to emit */ |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1715 g_signal_handlers_block_matched(ggblist->status, G_SIGNAL_MATCH_FUNC, |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1716 0, 0, NULL, status_selection_changed, NULL); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1717 g_signal_handlers_block_matched(ggblist->statustext, G_SIGNAL_MATCH_FUNC, |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1718 0, 0, NULL, status_text_changed, NULL); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1719 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1720 prim = gaim_savedstatus_get_type(now); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1721 message = gaim_savedstatus_get_message(now); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1722 |
14493
5ac8f22e7b08
[gaim-migrate @ 17212]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14477
diff
changeset
|
1723 /* Rebuild the status dropdown */ |
5ac8f22e7b08
[gaim-migrate @ 17212]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14477
diff
changeset
|
1724 populate_status_dropdown(); |
5ac8f22e7b08
[gaim-migrate @ 17212]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14477
diff
changeset
|
1725 |
15502
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
1726 while (!found) { |
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
1727 list = g_object_get_data(G_OBJECT(ggblist->status), "list of statuses"); |
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
1728 for (; list; list = list->next) |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1729 { |
15502
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
1730 StatusBoxItem *item = list->data; |
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
1731 if ((saved && item->type != STATUS_PRIMITIVE && item->u.saved == now) || |
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
1732 (!saved && item->type == STATUS_PRIMITIVE && item->u.prim == prim)) |
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
1733 { |
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
1734 char *mess = gaim_unescape_html(message); |
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
1735 gnt_combo_box_set_selected(GNT_COMBO_BOX(ggblist->status), item); |
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
1736 gnt_entry_set_text(GNT_ENTRY(ggblist->statustext), mess); |
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
1737 gnt_widget_draw(ggblist->status); |
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
1738 g_free(mess); |
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
1739 found = TRUE; |
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
1740 break; |
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
1741 } |
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
1742 } |
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
1743 if (!saved) |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1744 break; |
15502
704d40050800
Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15315
diff
changeset
|
1745 saved = FALSE; |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1746 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1747 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1748 g_signal_handlers_unblock_matched(ggblist->status, G_SIGNAL_MATCH_FUNC, |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1749 0, 0, NULL, status_selection_changed, NULL); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1750 g_signal_handlers_unblock_matched(ggblist->statustext, G_SIGNAL_MATCH_FUNC, |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1751 0, 0, NULL, status_text_changed, NULL); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1752 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1753 |
14105
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
1754 static int |
14712
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1755 blist_node_compare_text(GaimBlistNode *n1, GaimBlistNode *n2) |
14105
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
1756 { |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
1757 const char *s1, *s2; |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
1758 char *us1, *us2; |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
1759 int ret; |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
1760 |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
1761 g_return_val_if_fail(n1->type == n2->type, -1); |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
1762 |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
1763 switch (n1->type) |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
1764 { |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
1765 case GAIM_BLIST_GROUP_NODE: |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
1766 s1 = ((GaimGroup*)n1)->name; |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
1767 s2 = ((GaimGroup*)n2)->name; |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
1768 break; |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
1769 case GAIM_BLIST_CHAT_NODE: |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
1770 s1 = gaim_chat_get_name((GaimChat*)n1); |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
1771 s2 = gaim_chat_get_name((GaimChat*)n2); |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
1772 break; |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
1773 case GAIM_BLIST_BUDDY_NODE: |
14385
d1e4e986bbd1
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14384
diff
changeset
|
1774 return gaim_presence_compare(gaim_buddy_get_presence((GaimBuddy*)n1), |
d1e4e986bbd1
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14384
diff
changeset
|
1775 gaim_buddy_get_presence((GaimBuddy*)n2)); |
d1e4e986bbd1
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14384
diff
changeset
|
1776 break; |
d1e4e986bbd1
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14384
diff
changeset
|
1777 case GAIM_BLIST_CONTACT_NODE: |
d1e4e986bbd1
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14384
diff
changeset
|
1778 s1 = gaim_contact_get_alias((GaimContact*)n1); |
d1e4e986bbd1
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14384
diff
changeset
|
1779 s2 = gaim_contact_get_alias((GaimContact*)n2); |
14105
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
1780 break; |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
1781 default: |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
1782 return -1; |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
1783 } |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
1784 |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
1785 us1 = g_utf8_strup(s1, -1); |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
1786 us2 = g_utf8_strup(s2, -1); |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
1787 ret = g_utf8_collate(us1, us2); |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
1788 g_free(us1); |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
1789 g_free(us2); |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
1790 |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
1791 return ret; |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
1792 } |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
1793 |
14712
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1794 static int |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1795 blist_node_compare_status(GaimBlistNode *n1, GaimBlistNode *n2) |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1796 { |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1797 int ret; |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1798 |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1799 g_return_val_if_fail(n1->type == n2->type, -1); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1800 |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1801 switch (n1->type) { |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1802 case GAIM_BLIST_CONTACT_NODE: |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1803 n1 = (GaimBlistNode*)gaim_contact_get_priority_buddy((GaimContact*)n1); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1804 n2 = (GaimBlistNode*)gaim_contact_get_priority_buddy((GaimContact*)n2); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1805 /* now compare the presence of the priority buddies */ |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1806 case GAIM_BLIST_BUDDY_NODE: |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1807 ret = gaim_presence_compare(gaim_buddy_get_presence((GaimBuddy*)n1), |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1808 gaim_buddy_get_presence((GaimBuddy*)n2)); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1809 if (ret != 0) |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1810 return ret; |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1811 break; |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1812 default: |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1813 break; |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1814 } |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1815 |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1816 /* Sort alphabetically if presence is not comparable */ |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1817 ret = blist_node_compare_text(n1, n2); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1818 |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1819 return ret; |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1820 } |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1821 |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1822 static int |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1823 get_contact_log_size(GaimBlistNode *c) |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1824 { |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1825 int log = 0; |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1826 GaimBlistNode *node; |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1827 |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1828 for (node = c->child; node; node = node->next) { |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1829 GaimBuddy *b = (GaimBuddy*)node; |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1830 log += gaim_log_get_total_size(GAIM_LOG_IM, b->name, b->account); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1831 } |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1832 |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1833 return log; |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1834 } |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1835 |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1836 static int |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1837 blist_node_compare_log(GaimBlistNode *n1, GaimBlistNode *n2) |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1838 { |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1839 int ret; |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1840 GaimBuddy *b1, *b2; |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1841 |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1842 g_return_val_if_fail(n1->type == n2->type, -1); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1843 |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1844 switch (n1->type) { |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1845 case GAIM_BLIST_BUDDY_NODE: |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1846 b1 = (GaimBuddy*)n1; |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1847 b2 = (GaimBuddy*)n2; |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1848 ret = gaim_log_get_total_size(GAIM_LOG_IM, b2->name, b2->account) - |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1849 gaim_log_get_total_size(GAIM_LOG_IM, b1->name, b1->account); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1850 if (ret != 0) |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1851 return ret; |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1852 break; |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1853 case GAIM_BLIST_CONTACT_NODE: |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1854 ret = get_contact_log_size(n2) - get_contact_log_size(n1); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1855 if (ret != 0) |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1856 return ret; |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1857 break; |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1858 default: |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1859 break; |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1860 } |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1861 ret = blist_node_compare_text(n1, n2); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1862 return ret; |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1863 } |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1864 |
14477
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14475
diff
changeset
|
1865 static gboolean |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14475
diff
changeset
|
1866 blist_clicked(GntTree *tree, GntMouseEvent event, int x, int y, gpointer ggblist) |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14475
diff
changeset
|
1867 { |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14475
diff
changeset
|
1868 if (event == GNT_RIGHT_MOUSE_DOWN) { |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14475
diff
changeset
|
1869 draw_context_menu(ggblist); |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14475
diff
changeset
|
1870 } |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14475
diff
changeset
|
1871 return FALSE; |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14475
diff
changeset
|
1872 } |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14475
diff
changeset
|
1873 |
14616
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
1874 static void |
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
1875 plugin_action(GntMenuItem *item, gpointer data) |
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
1876 { |
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
1877 GaimPluginAction *action = data; |
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
1878 if (action && action->callback) |
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
1879 action->callback(action); |
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
1880 } |
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
1881 |
14883
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1882 static void |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1883 build_plugin_actions(GntMenuItem *item, GaimPlugin *plugin, gpointer context) |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1884 { |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1885 GntWidget *sub = gnt_menu_new(GNT_MENU_POPUP); |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1886 GList *actions; |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1887 GntMenuItem *menuitem; |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1888 |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1889 gnt_menuitem_set_submenu(item, GNT_MENU(sub)); |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1890 for (actions = GAIM_PLUGIN_ACTIONS(plugin, context); actions; |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1891 actions = g_list_delete_link(actions, actions)) { |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1892 if (actions->data) { |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1893 GaimPluginAction *action = actions->data; |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1894 action->plugin = plugin; |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1895 action->context = context; |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1896 menuitem = gnt_menuitem_new(action->label); |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1897 gnt_menu_add_item(GNT_MENU(sub), menuitem); |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1898 |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1899 gnt_menuitem_set_callback(menuitem, plugin_action, action); |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1900 g_object_set_data_full(G_OBJECT(menuitem), "plugin_action", |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1901 action, (GDestroyNotify)gaim_plugin_action_free); |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1902 } |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1903 } |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1904 } |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1905 |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1906 static void |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1907 reconstruct_plugins_menu() |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1908 { |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1909 GntWidget *sub; |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1910 GntMenuItem *plg; |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1911 GList *iter; |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1912 |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1913 if (!ggblist) |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1914 return; |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1915 |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1916 if (ggblist->plugins == NULL) |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1917 ggblist->plugins = gnt_menuitem_new(_("Plugins")); |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1918 |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1919 plg = ggblist->plugins; |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1920 sub = gnt_menu_new(GNT_MENU_POPUP); |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1921 gnt_menuitem_set_submenu(plg, GNT_MENU(sub)); |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1922 |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1923 for (iter = gaim_plugins_get_loaded(); iter; iter = iter->next) { |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1924 GaimPlugin *plugin = iter->data; |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1925 GntMenuItem *item; |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1926 if (GAIM_IS_PROTOCOL_PLUGIN(plugin)) |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1927 continue; |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1928 |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1929 if (!GAIM_PLUGIN_HAS_ACTIONS(plugin)) |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1930 continue; |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1931 |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1932 item = gnt_menuitem_new(_(plugin->info->name)); |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1933 gnt_menu_add_item(GNT_MENU(sub), item); |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1934 build_plugin_actions(item, plugin, NULL); |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1935 } |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1936 } |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1937 |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1938 static void |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1939 reconstruct_accounts_menu() |
14616
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
1940 { |
14712
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1941 GntWidget *sub; |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1942 GntMenuItem *acc, *item; |
14616
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
1943 GList *iter; |
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
1944 |
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
1945 if (!ggblist) |
14883
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1946 return; |
14616
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
1947 |
14883
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1948 if (ggblist->accounts == NULL) |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1949 ggblist->accounts = gnt_menuitem_new(_("Accounts")); |
14616
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
1950 |
14883
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1951 acc = ggblist->accounts; |
14616
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
1952 sub = gnt_menu_new(GNT_MENU_POPUP); |
14712
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1953 gnt_menuitem_set_submenu(acc, GNT_MENU(sub)); |
14616
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
1954 |
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
1955 for (iter = gaim_accounts_get_all_active(); iter; |
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
1956 iter = g_list_delete_link(iter, iter)) { |
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
1957 GaimAccount *account = iter->data; |
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
1958 GaimConnection *gc = gaim_account_get_connection(account); |
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
1959 GaimPlugin *prpl; |
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
1960 |
14630
275c84b1b2a4
[gaim-migrate @ 17376]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14616
diff
changeset
|
1961 if (!gc || !GAIM_CONNECTION_IS_CONNECTED(gc)) |
14616
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
1962 continue; |
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
1963 prpl = gc->prpl; |
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
1964 |
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
1965 if (GAIM_PLUGIN_HAS_ACTIONS(prpl)) { |
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
1966 item = gnt_menuitem_new(gaim_account_get_username(account)); |
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
1967 gnt_menu_add_item(GNT_MENU(sub), item); |
14883
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
1968 build_plugin_actions(item, prpl, gc); |
14616
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
1969 } |
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
1970 } |
14712
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1971 } |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1972 |
15180
4b500bd49d38
[gaim-migrate @ 17967]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15179
diff
changeset
|
1973 static void |
4b500bd49d38
[gaim-migrate @ 17967]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15179
diff
changeset
|
1974 account_signed_on_cb() |
4b500bd49d38
[gaim-migrate @ 17967]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15179
diff
changeset
|
1975 { |
4b500bd49d38
[gaim-migrate @ 17967]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15179
diff
changeset
|
1976 GaimBlistNode *node; |
4b500bd49d38
[gaim-migrate @ 17967]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15179
diff
changeset
|
1977 |
4b500bd49d38
[gaim-migrate @ 17967]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15179
diff
changeset
|
1978 for (node = gaim_blist_get_root(); node; |
4b500bd49d38
[gaim-migrate @ 17967]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15179
diff
changeset
|
1979 node = gaim_blist_node_next(node, FALSE)) { |
4b500bd49d38
[gaim-migrate @ 17967]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15179
diff
changeset
|
1980 if (GAIM_BLIST_NODE_IS_CHAT(node)) { |
4b500bd49d38
[gaim-migrate @ 17967]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15179
diff
changeset
|
1981 GaimChat *chat = (GaimChat*)node; |
4b500bd49d38
[gaim-migrate @ 17967]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15179
diff
changeset
|
1982 if (gaim_blist_node_get_bool(node, "gnt-autojoin")) |
4b500bd49d38
[gaim-migrate @ 17967]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15179
diff
changeset
|
1983 serv_join_chat(gaim_account_get_connection(chat->account), chat->components); |
4b500bd49d38
[gaim-migrate @ 17967]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15179
diff
changeset
|
1984 } |
4b500bd49d38
[gaim-migrate @ 17967]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15179
diff
changeset
|
1985 } |
4b500bd49d38
[gaim-migrate @ 17967]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15179
diff
changeset
|
1986 } |
4b500bd49d38
[gaim-migrate @ 17967]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15179
diff
changeset
|
1987 |
14712
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1988 static void show_offline_cb(GntMenuItem *item, gpointer n) |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1989 { |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1990 gaim_prefs_set_bool(PREF_ROOT "/showoffline", |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1991 !gaim_prefs_get_bool(PREF_ROOT "/showoffline")); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1992 } |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1993 |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1994 static void sort_blist_change_cb(GntMenuItem *item, gpointer n) |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1995 { |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1996 gaim_prefs_set_string(PREF_ROOT "/sort_type", n); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1997 } |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
1998 |
14889
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
1999 /* XXX: send_im_select* -- Xerox */ |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2000 static void |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2001 send_im_select_cb(gpointer data, GaimRequestFields *fields) |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2002 { |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2003 GaimAccount *account; |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2004 const char *username; |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2005 |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2006 account = gaim_request_fields_get_account(fields, "account"); |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2007 username = gaim_request_fields_get_string(fields, "screenname"); |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2008 |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2009 gaim_conversation_new(GAIM_CONV_TYPE_IM, account, username); |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2010 } |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2011 |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2012 static void |
14919
056c8a27668c
[gaim-migrate @ 17691]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14889
diff
changeset
|
2013 send_im_select(GntMenuItem *item, gpointer n) |
14889
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2014 { |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2015 GaimRequestFields *fields; |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2016 GaimRequestFieldGroup *group; |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2017 GaimRequestField *field; |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2018 |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2019 fields = gaim_request_fields_new(); |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2020 |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2021 group = gaim_request_field_group_new(NULL); |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2022 gaim_request_fields_add_group(fields, group); |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2023 |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2024 field = gaim_request_field_string_new("screenname", _("_Name"), NULL, FALSE); |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2025 gaim_request_field_set_type_hint(field, "screenname"); |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2026 gaim_request_field_set_required(field, TRUE); |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2027 gaim_request_field_group_add_field(group, field); |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2028 |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2029 field = gaim_request_field_account_new("account", _("_Account"), NULL); |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2030 gaim_request_field_set_type_hint(field, "account"); |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2031 gaim_request_field_set_visible(field, |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2032 (gaim_connections_get_all() != NULL && |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2033 gaim_connections_get_all()->next != NULL)); |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2034 gaim_request_field_set_required(field, TRUE); |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2035 gaim_request_field_group_add_field(group, field); |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2036 |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2037 gaim_request_fields(gaim_get_blist(), _("New Instant Message"), |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2038 NULL, |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2039 _("Please enter the screen name or alias of the person " |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2040 "you would like to IM."), |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2041 fields, |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2042 _("OK"), G_CALLBACK(send_im_select_cb), |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2043 _("Cancel"), NULL, |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2044 NULL); |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2045 } |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2046 |
14712
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2047 static void |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2048 create_menu() |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2049 { |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2050 GntWidget *menu, *sub; |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2051 GntMenuItem *item; |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2052 GntWindow *window; |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2053 |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2054 if (!ggblist) |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2055 return; |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2056 |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2057 window = GNT_WINDOW(ggblist->window); |
14883
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
2058 ggblist->menu = menu = gnt_menu_new(GNT_MENU_TOPLEVEL); |
14712
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2059 gnt_window_set_menu(window, GNT_MENU(menu)); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2060 |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2061 item = gnt_menuitem_new(_("Options")); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2062 gnt_menu_add_item(GNT_MENU(menu), item); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2063 |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2064 sub = gnt_menu_new(GNT_MENU_POPUP); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2065 gnt_menuitem_set_submenu(item, GNT_MENU(sub)); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2066 |
14889
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2067 item = gnt_menuitem_new(_("Send IM...")); |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2068 gnt_menu_add_item(GNT_MENU(sub), item); |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2069 gnt_menuitem_set_callback(GNT_MENUITEM(item), send_im_select, NULL); |
ea920bd4a00b
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14883
diff
changeset
|
2070 |
14712
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2071 item = gnt_menuitem_new(_("Toggle offline buddies")); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2072 gnt_menu_add_item(GNT_MENU(sub), item); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2073 gnt_menuitem_set_callback(GNT_MENUITEM(item), show_offline_cb, NULL); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2074 |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2075 item = gnt_menuitem_new(_("Sort by status")); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2076 gnt_menu_add_item(GNT_MENU(sub), item); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2077 gnt_menuitem_set_callback(GNT_MENUITEM(item), sort_blist_change_cb, "status"); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2078 |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2079 item = gnt_menuitem_new(_("Sort alphabetically")); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2080 gnt_menu_add_item(GNT_MENU(sub), item); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2081 gnt_menuitem_set_callback(GNT_MENUITEM(item), sort_blist_change_cb, "text"); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2082 |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2083 item = gnt_menuitem_new(_("Sort by log size")); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2084 gnt_menu_add_item(GNT_MENU(sub), item); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2085 gnt_menuitem_set_callback(GNT_MENUITEM(item), sort_blist_change_cb, "log"); |
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2086 |
14883
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
2087 reconstruct_accounts_menu(); |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
2088 gnt_menu_add_item(GNT_MENU(menu), ggblist->accounts); |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
2089 |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
2090 reconstruct_plugins_menu(); |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
2091 gnt_menu_add_item(GNT_MENU(menu), ggblist->plugins); |
14616
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
2092 } |
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
2093 |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
2094 void gg_blist_show() |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
2095 { |
14847
d478f3853671
[gaim-migrate @ 17616]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14846
diff
changeset
|
2096 blist_show(gaim_get_blist()); |
d478f3853671
[gaim-migrate @ 17616]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14846
diff
changeset
|
2097 } |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
2098 |
14847
d478f3853671
[gaim-migrate @ 17616]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14846
diff
changeset
|
2099 static void |
d478f3853671
[gaim-migrate @ 17616]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14846
diff
changeset
|
2100 blist_show(GaimBuddyList *list) |
d478f3853671
[gaim-migrate @ 17616]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14846
diff
changeset
|
2101 { |
d478f3853671
[gaim-migrate @ 17616]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14846
diff
changeset
|
2102 if (ggblist == NULL) |
d478f3853671
[gaim-migrate @ 17616]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14846
diff
changeset
|
2103 new_list(list); |
d478f3853671
[gaim-migrate @ 17616]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14846
diff
changeset
|
2104 else if (ggblist->window) |
d478f3853671
[gaim-migrate @ 17616]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14846
diff
changeset
|
2105 return; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2106 |
14616
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
2107 ggblist->window = gnt_vwindow_new(FALSE); |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13865
diff
changeset
|
2108 gnt_widget_set_name(ggblist->window, "buddylist"); |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
2109 gnt_box_set_toplevel(GNT_BOX(ggblist->window), TRUE); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2110 gnt_box_set_title(GNT_BOX(ggblist->window), _("Buddy List")); |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
2111 gnt_box_set_pad(GNT_BOX(ggblist->window), 0); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2112 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2113 ggblist->tree = gnt_tree_new(); |
14712
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2114 |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
2115 GNT_WIDGET_SET_FLAGS(ggblist->tree, GNT_WIDGET_NO_BORDER); |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
2116 gnt_widget_set_size(ggblist->tree, gaim_prefs_get_int(PREF_ROOT "/size/width"), |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
2117 gaim_prefs_get_int(PREF_ROOT "/size/height")); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
2118 gnt_widget_set_position(ggblist->window, gaim_prefs_get_int(PREF_ROOT "/position/x"), |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
2119 gaim_prefs_get_int(PREF_ROOT "/position/y")); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2120 |
14846
c7651586e27b
[gaim-migrate @ 17615]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14843
diff
changeset
|
2121 gnt_tree_set_col_width(GNT_TREE(ggblist->tree), 0, |
c7651586e27b
[gaim-migrate @ 17615]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14843
diff
changeset
|
2122 gaim_prefs_get_int(PREF_ROOT "/size/width") - 1); |
c7651586e27b
[gaim-migrate @ 17615]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14843
diff
changeset
|
2123 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2124 gnt_box_add_widget(GNT_BOX(ggblist->window), ggblist->tree); |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
2125 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
2126 ggblist->status = gnt_combo_box_new(); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
2127 gnt_box_add_widget(GNT_BOX(ggblist->window), ggblist->status); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
2128 ggblist->statustext = gnt_entry_new(NULL); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
2129 gnt_box_add_widget(GNT_BOX(ggblist->window), ggblist->statustext); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
2130 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2131 gnt_widget_show(ggblist->window); |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
2132 |
14616
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
2133 gaim_signal_connect(gaim_connections_get_handle(), "signed-on", gg_blist_get_handle(), |
14883
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
2134 GAIM_CALLBACK(reconstruct_accounts_menu), NULL); |
14616
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
2135 gaim_signal_connect(gaim_connections_get_handle(), "signed-off", gg_blist_get_handle(), |
14883
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
2136 GAIM_CALLBACK(reconstruct_accounts_menu), NULL); |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
2137 gaim_signal_connect(gaim_blist_get_handle(), "buddy-status-changed", gg_blist_get_handle(), |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
2138 GAIM_CALLBACK(buddy_status_changed), ggblist); |
13931
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
2139 gaim_signal_connect(gaim_blist_get_handle(), "buddy-idle-changed", gg_blist_get_handle(), |
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
2140 GAIM_CALLBACK(buddy_idle_changed), ggblist); |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
2141 |
14883
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
2142 gaim_signal_connect(gaim_plugins_get_handle(), "plugin-load", gg_blist_get_handle(), |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
2143 GAIM_CALLBACK(reconstruct_plugins_menu), NULL); |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
2144 gaim_signal_connect(gaim_plugins_get_handle(), "plugin-unload", gg_blist_get_handle(), |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
2145 GAIM_CALLBACK(reconstruct_plugins_menu), NULL); |
c8cd118653fc
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14850
diff
changeset
|
2146 |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
2147 #if 0 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2148 gaim_signal_connect(gaim_blist_get_handle(), "buddy-signed-on", gg_blist_get_handle(), |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2149 GAIM_CALLBACK(buddy_signed_on), ggblist); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2150 gaim_signal_connect(gaim_blist_get_handle(), "buddy-signed-off", gg_blist_get_handle(), |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2151 GAIM_CALLBACK(buddy_signed_off), ggblist); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2152 |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
2153 /* These I plan to use to indicate unread-messages etc. */ |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
2154 gaim_signal_connect(gaim_conversations_get_handle(), "received-im-msg", gg_blist_get_handle(), |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
2155 GAIM_CALLBACK(received_im_msg), list); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
2156 gaim_signal_connect(gaim_conversations_get_handle(), "sent-im-msg", gg_blist_get_handle(), |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
2157 GAIM_CALLBACK(sent_im_msg), NULL); |
13857
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
2158 |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
2159 gaim_signal_connect(gaim_conversations_get_handle(), "received-chat-msg", gg_blist_get_handle(), |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
2160 GAIM_CALLBACK(received_chat_msg), list); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
2161 #endif |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2162 |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
2163 g_signal_connect(G_OBJECT(ggblist->tree), "selection_changed", G_CALLBACK(selection_changed), ggblist); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
2164 g_signal_connect(G_OBJECT(ggblist->tree), "key_pressed", G_CALLBACK(key_pressed), ggblist); |
14834
52022b0a9405
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14712
diff
changeset
|
2165 g_signal_connect(G_OBJECT(ggblist->tree), "context-menu", G_CALLBACK(context_menu), ggblist); |
14477
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14475
diff
changeset
|
2166 g_signal_connect_after(G_OBJECT(ggblist->tree), "clicked", G_CALLBACK(blist_clicked), ggblist); |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
2167 g_signal_connect(G_OBJECT(ggblist->tree), "activate", G_CALLBACK(selection_activate), ggblist); |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
2168 g_signal_connect_data(G_OBJECT(ggblist->tree), "gained-focus", G_CALLBACK(draw_tooltip), |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
2169 ggblist, 0, G_CONNECT_AFTER | G_CONNECT_SWAPPED); |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
2170 g_signal_connect_data(G_OBJECT(ggblist->tree), "lost-focus", G_CALLBACK(remove_peripherals), |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
2171 ggblist, 0, G_CONNECT_AFTER | G_CONNECT_SWAPPED); |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
2172 g_signal_connect(G_OBJECT(ggblist->tree), "size_changed", G_CALLBACK(size_changed_cb), NULL); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
2173 g_signal_connect(G_OBJECT(ggblist->window), "position_set", G_CALLBACK(save_position_cb), NULL); |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
2174 g_signal_connect(G_OBJECT(ggblist->window), "destroy", G_CALLBACK(reset_blist_window), NULL); |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
2175 |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
2176 /* Status signals */ |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
2177 gaim_signal_connect(gaim_savedstatuses_get_handle(), "savedstatus-changed", gg_blist_get_handle(), |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
2178 GAIM_CALLBACK(savedstatus_changed), NULL); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
2179 g_signal_connect(G_OBJECT(ggblist->status), "selection_changed", |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
2180 G_CALLBACK(status_selection_changed), NULL); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
2181 g_signal_connect(G_OBJECT(ggblist->statustext), "key_pressed", |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
2182 G_CALLBACK(status_text_changed), NULL); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
2183 |
14712
b15c2eaeb67f
[gaim-migrate @ 17466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14708
diff
changeset
|
2184 create_menu(); |
14616
f1f1dcb26d89
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
2185 |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
2186 populate_buddylist(); |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
2187 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
2188 savedstatus_changed(gaim_savedstatus_get_current(), NULL); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2189 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2190 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
2191 void gg_blist_uninit() |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
2192 { |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
2193 if (ggblist == NULL) |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
2194 return; |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
2195 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
2196 gnt_widget_destroy(ggblist->window); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
2197 g_free(ggblist); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
2198 ggblist = NULL; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
2199 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
2200 |
14351
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
2201 gboolean gg_blist_get_position(int *x, int *y) |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
2202 { |
14351
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
2203 if (!ggblist || !ggblist->window) |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
2204 return FALSE; |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
2205 gnt_widget_get_position(ggblist->window, x, y); |
14351
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
2206 return TRUE; |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
2207 } |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
2208 |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
2209 void gg_blist_set_position(int x, int y) |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
2210 { |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
2211 gnt_widget_set_position(ggblist->window, x, y); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
2212 } |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
2213 |
14351
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
2214 gboolean gg_blist_get_size(int *width, int *height) |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
2215 { |
14351
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
2216 if (!ggblist || !ggblist->window) |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
2217 return FALSE; |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
2218 gnt_widget_get_size(ggblist->window, width, height); |
14351
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14218
diff
changeset
|
2219 return TRUE; |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
2220 } |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
2221 |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
2222 void gg_blist_set_size(int width, int height) |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
2223 { |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
2224 gnt_widget_set_size(ggblist->window, width, height); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
2225 } |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
2226 |