Mercurial > pidgin
annotate console/gntblist.c @ 14099:7b030f6ed1c3
[gaim-migrate @ 16728]
Extremely minor error message improvements
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sat, 12 Aug 2006 22:16:23 +0000 |
parents | 8ef994bacf3d |
children | eaf7f35635bc |
rev | line source |
---|---|
13877
765bbdf29d04
[gaim-migrate @ 16354]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1 #include <account.h> |
765bbdf29d04
[gaim-migrate @ 16354]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
2 #include <blist.h> |
14062
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
3 #include <notify.h> |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
4 #include <request.h> |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
5 #include <savedstatuses.h> |
13877
765bbdf29d04
[gaim-migrate @ 16354]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
6 #include <server.h> |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
7 #include <signal.h> |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
8 #include <status.h> |
13877
765bbdf29d04
[gaim-migrate @ 16354]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
9 #include <util.h> |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
10 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
11 #include "gntgaim.h" |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
12 #include "gntbox.h" |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
13 #include "gntcombobox.h" |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
14 #include "gntentry.h" |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
15 #include "gntlabel.h" |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
16 #include "gntline.h" |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
17 #include "gnttree.h" |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
18 |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
19 #include "gntblist.h" |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
20 #include <string.h> |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
21 |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
22 #define PREF_ROOT "/gaim/gnt/blist" |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
23 #define TYPING_TIMEOUT 4000 |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
24 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
25 typedef struct |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
26 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
27 GntWidget *window; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
28 GntWidget *tree; |
13857
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
29 |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
30 GntWidget *tooltip; |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
31 GaimBlistNode *tnode; /* Who is the tooltip being displayed for? */ |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
32 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
33 GntWidget *context; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
34 GaimBlistNode *cnode; |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
35 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
36 /* XXX: I am KISSing */ |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
37 GntWidget *status; /* Dropdown with the statuses */ |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
38 GntWidget *statustext; /* Status message */ |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
39 int typing; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
40 } GGBlist; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
41 |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
42 typedef enum |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
43 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
44 STATUS_PRIMITIVE = 0, |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
45 STATUS_SAVED |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
46 } StatusType; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
47 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
48 typedef struct |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
49 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
50 StatusType type; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
51 union |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
52 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
53 GaimStatusPrimitive prim; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
54 GaimSavedStatus *saved; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
55 } u; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
56 } StatusBoxItem; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
57 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
58 GGBlist *ggblist; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
59 |
13857
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
60 static void add_buddy(GaimBuddy *buddy, GGBlist *ggblist); |
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
61 static void add_group(GaimGroup *group, GGBlist *ggblist); |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
62 static void add_chat(GaimChat *chat, GGBlist *ggblist); |
13865
d78ab363e02d
[gaim-migrate @ 16331]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13864
diff
changeset
|
63 static void add_node(GaimBlistNode *node, GGBlist *ggblist); |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
64 static void draw_tooltip(GGBlist *ggblist); |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14042
diff
changeset
|
65 static gboolean remove_typing_cb(gpointer null); |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
66 static void remove_peripherals(GGBlist *ggblist); |
14018
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
67 static const char * get_display_name(GaimBlistNode *node); |
13857
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
68 |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
69 static void |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
70 new_node(GaimBlistNode *node) |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
71 { |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
72 } |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
73 |
13865
d78ab363e02d
[gaim-migrate @ 16331]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13864
diff
changeset
|
74 static void add_node(GaimBlistNode *node, GGBlist *ggblist) |
d78ab363e02d
[gaim-migrate @ 16331]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13864
diff
changeset
|
75 { |
d78ab363e02d
[gaim-migrate @ 16331]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13864
diff
changeset
|
76 if (GAIM_BLIST_NODE_IS_BUDDY(node)) |
d78ab363e02d
[gaim-migrate @ 16331]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13864
diff
changeset
|
77 add_buddy((GaimBuddy*)node, ggblist); |
d78ab363e02d
[gaim-migrate @ 16331]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13864
diff
changeset
|
78 else if (GAIM_BLIST_NODE_IS_GROUP(node)) |
d78ab363e02d
[gaim-migrate @ 16331]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13864
diff
changeset
|
79 add_group((GaimGroup*)node, ggblist); |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
80 else if (GAIM_BLIST_NODE_IS_CHAT(node)) |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
81 add_chat((GaimChat *)node, ggblist); |
13865
d78ab363e02d
[gaim-migrate @ 16331]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13864
diff
changeset
|
82 draw_tooltip(ggblist); |
d78ab363e02d
[gaim-migrate @ 16331]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13864
diff
changeset
|
83 } |
d78ab363e02d
[gaim-migrate @ 16331]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13864
diff
changeset
|
84 |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
85 static void |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
86 remove_tooltip(GGBlist *ggblist) |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
87 { |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
88 gnt_widget_destroy(ggblist->tooltip); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
89 ggblist->tooltip = NULL; |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
90 ggblist->tnode = NULL; |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
91 } |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
92 |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
93 static void |
13857
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
94 node_remove(GaimBuddyList *list, GaimBlistNode *node) |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
95 { |
13857
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
96 GGBlist *ggblist = list->ui_data; |
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
97 |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
98 if (ggblist == NULL || node->ui_data == NULL) |
13857
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
99 return; |
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
100 |
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
101 gnt_tree_remove(GNT_TREE(ggblist->tree), node); |
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
102 node->ui_data = NULL; |
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
103 |
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
104 if (GAIM_BLIST_NODE_IS_BUDDY(node)) |
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
105 { |
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
106 GaimGroup *group = gaim_buddy_get_group((GaimBuddy*)node); |
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
107 if (gaim_blist_get_group_online_count(group) == 0) |
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
108 node_remove(list, (GaimBlistNode*)group); |
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
109 } |
13865
d78ab363e02d
[gaim-migrate @ 16331]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13864
diff
changeset
|
110 draw_tooltip(ggblist); |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
111 } |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
112 |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
113 static void |
13857
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
114 node_update(GaimBuddyList *list, GaimBlistNode *node) |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
115 { |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
116 if (list->ui_data == NULL) |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
117 return; |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
118 |
14018
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
119 if (node->ui_data != NULL) |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
120 { |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
121 gnt_tree_change_text(GNT_TREE(ggblist->tree), node, |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
122 0, get_display_name(node)); |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
123 } |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
124 |
13857
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
125 if (GAIM_BLIST_NODE_IS_BUDDY(node)) |
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
126 { |
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
127 GaimBuddy *buddy = (GaimBuddy*)node; |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
128 if (gaim_presence_is_online(gaim_buddy_get_presence(buddy))) |
13865
d78ab363e02d
[gaim-migrate @ 16331]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13864
diff
changeset
|
129 add_node((GaimBlistNode*)buddy, list->ui_data); |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
130 else |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
131 node_remove(gaim_get_blist(), node); |
13857
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
132 } |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
133 else if (GAIM_BLIST_NODE_IS_CHAT(node)) |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
134 { |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
135 add_chat((GaimChat *)node, list->ui_data); |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
136 } |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
137 } |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
138 |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
139 static void |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
140 new_list(GaimBuddyList *list) |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
141 { |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
142 } |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
143 |
14062
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
144 static void |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
145 add_buddy_cb(void *data, GaimRequestFields *allfields) |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
146 { |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
147 const char *username = gaim_request_fields_get_string(allfields, "screenname"); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
148 const char *alias = gaim_request_fields_get_string(allfields, "alias"); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
149 const char *group = gaim_request_fields_get_string(allfields, "group"); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
150 GaimAccount *account = gaim_request_fields_get_account(allfields, "account"); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
151 const char *error = NULL; |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
152 GaimGroup *grp; |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
153 GaimBuddy *buddy; |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
154 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
155 if (!username) |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
156 error = _("You must provide a screename for the buddy."); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
157 else if (!group) |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
158 error = _("You must provide a group."); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
159 else if (!account) |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
160 error = _("You must select an account."); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
161 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
162 if (error) |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
163 { |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
164 gaim_notify_error(NULL, _("Error"), _("Error adding buddy"), error); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
165 return; |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
166 } |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
167 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
168 grp = gaim_find_group(group); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
169 if (!grp) |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
170 { |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
171 grp = gaim_group_new(group); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
172 gaim_blist_add_group(grp, NULL); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
173 } |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
174 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
175 buddy = gaim_buddy_new(account, username, alias); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
176 gaim_blist_add_buddy(buddy, NULL, grp, NULL); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
177 gaim_account_add_buddy(account, buddy); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
178 } |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
179 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
180 static void |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
181 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
|
182 { |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
183 GaimRequestFields *fields = gaim_request_fields_new(); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
184 GaimRequestFieldGroup *group = gaim_request_field_group_new(NULL); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
185 GaimRequestField *field; |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
186 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
187 gaim_request_fields_add_group(fields, group); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
188 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
189 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
|
190 gaim_request_field_group_add_field(group, field); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
191 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
192 field = gaim_request_field_string_new("alias", _("Alias"), alias, FALSE); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
193 gaim_request_field_group_add_field(group, field); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
194 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
195 field = gaim_request_field_string_new("group", _("Group"), grp, FALSE); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
196 gaim_request_field_group_add_field(group, field); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
197 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
198 field = gaim_request_field_account_new("account", _("Account"), NULL); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
199 gaim_request_field_account_set_show_all(field, FALSE); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
200 if (account) |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
201 gaim_request_field_account_set_value(field, account); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
202 gaim_request_field_group_add_field(group, field); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
203 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
204 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
|
205 fields, _("Add"), G_CALLBACK(add_buddy_cb), _("Cancel"), NULL, NULL); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
206 } |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
207 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
208 static void |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
209 add_group_cb(gpointer null, const char *group) |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
210 { |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
211 GaimGroup *grp; |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
212 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
213 if (!group || !*group) |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
214 { |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
215 gaim_notify_error(NULL, _("Error"), _("Error adding group"), |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
216 _("You must give a name for the group to add.")); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
217 return; |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
218 } |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
219 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
220 grp = gaim_find_group(group); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
221 if (!grp) |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
222 { |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
223 grp = gaim_group_new(group); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
224 gaim_blist_add_group(grp, NULL); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
225 } |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
226 else |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
227 { |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
228 gaim_notify_error(NULL, _("Error"), _("Error adding group"), |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
229 _("A group with the name already exists.")); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
230 } |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
231 } |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
232 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
233 static void |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
234 gg_request_add_group() |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
235 { |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
236 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
|
237 NULL, FALSE, FALSE, NULL, |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
238 _("Add"), G_CALLBACK(add_group_cb), _("Cancel"), NULL, NULL); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
239 } |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
240 |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
241 static GaimBlistUiOps blist_ui_ops = |
13853
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 new_list, |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
244 new_node, |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
245 NULL, |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
246 node_update, /* This doesn't do crap */ |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
247 node_remove, |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
248 NULL, |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
249 NULL, |
14062
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
250 .request_add_buddy = gg_request_add_buddy, |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
251 NULL, |
14062
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
252 .request_add_group = gg_request_add_group |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
253 }; |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
254 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
255 static gpointer |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
256 gg_blist_get_handle() |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
257 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
258 static int handle; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
259 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
260 return &handle; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
261 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
262 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
263 static void |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
264 add_group(GaimGroup *group, GGBlist *ggblist) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
265 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
266 GaimBlistNode *node = (GaimBlistNode *)group; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
267 if (node->ui_data) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
268 return; |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13959
diff
changeset
|
269 gnt_tree_remove(GNT_TREE(ggblist->tree), group); |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
270 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
|
271 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
|
272 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
273 |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
274 static const char * |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
275 get_display_name(GaimBlistNode *node) |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
276 { |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
277 static char text[2096]; |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
278 char status[8] = " "; |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
279 const char *name = NULL; |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
280 |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
281 if (GAIM_BLIST_NODE_IS_BUDDY(node)) |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
282 { |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
283 GaimBuddy *buddy = (GaimBuddy *)node; |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
284 GaimStatusPrimitive prim; |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
285 GaimPresence *presence; |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
286 GaimStatus *now; |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13916
diff
changeset
|
287 gboolean ascii = gnt_ascii_only(); |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
288 |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
289 presence = gaim_buddy_get_presence(buddy); |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
290 now = gaim_presence_get_active_status(presence); |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
291 |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
292 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
|
293 |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
294 switch(prim) |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
295 { |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
296 case GAIM_STATUS_OFFLINE: |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13916
diff
changeset
|
297 strncpy(status, ascii ? "x" : "⊗", sizeof(status) - 1); |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
298 break; |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
299 case GAIM_STATUS_AVAILABLE: |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13916
diff
changeset
|
300 strncpy(status, ascii ? "o" : "â—¯", sizeof(status) - 1); |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
301 break; |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
302 default: |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13916
diff
changeset
|
303 strncpy(status, ascii ? "." : "⊖", sizeof(status) - 1); |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
304 break; |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
305 } |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
306 name = gaim_buddy_get_alias(buddy); |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
307 } |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
308 else if (GAIM_BLIST_NODE_IS_CHAT(node)) |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
309 { |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
310 GaimChat *chat = (GaimChat*)node; |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
311 name = gaim_chat_get_name(chat); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13884
diff
changeset
|
312 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13884
diff
changeset
|
313 strncpy(status, "~", sizeof(status) - 1); |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
314 } |
14018
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
315 else if (GAIM_BLIST_NODE_IS_GROUP(node)) |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
316 return ((GaimGroup*)node)->name; |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
317 |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
318 snprintf(text, sizeof(text) - 1, "%s %s", status, name); |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
319 |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
320 return text; |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
321 } |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
322 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
323 static void |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
324 add_chat(GaimChat *chat, GGBlist *ggblist) |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
325 { |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
326 GaimGroup *group; |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
327 GaimBlistNode *node = (GaimBlistNode *)chat; |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
328 if (node->ui_data) |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
329 return; |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
330 if (!gaim_account_is_connected(chat->account)) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
331 return; |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
332 |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
333 group = gaim_chat_get_group(chat); |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
334 add_node((GaimBlistNode*)group, ggblist); |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
335 |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13959
diff
changeset
|
336 gnt_tree_remove(GNT_TREE(ggblist->tree), chat); |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
337 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
|
338 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
|
339 group, NULL); |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
340 } |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
341 |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
342 static void |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
343 add_buddy(GaimBuddy *buddy, GGBlist *ggblist) |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
344 { |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
345 GaimGroup *group; |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
346 GaimBlistNode *node = (GaimBlistNode *)buddy; |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
347 if (node->ui_data) |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
348 return; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
349 |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
350 group = gaim_buddy_get_group(buddy); |
13865
d78ab363e02d
[gaim-migrate @ 16331]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13864
diff
changeset
|
351 add_node((GaimBlistNode*)group, ggblist); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
352 |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13959
diff
changeset
|
353 gnt_tree_remove(GNT_TREE(ggblist->tree), buddy); |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
354 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
|
355 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
|
356 group, NULL); |
13931
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
357 if (gaim_presence_is_idle(gaim_buddy_get_presence(buddy))) |
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
358 gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), buddy, GNT_TEXT_FLAG_DIM); |
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
359 else |
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
360 gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), buddy, 0); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
361 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
362 |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
363 #if 0 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
364 static void |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
365 buddy_signed_on(GaimBuddy *buddy, GGBlist *ggblist) |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
366 { |
13865
d78ab363e02d
[gaim-migrate @ 16331]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13864
diff
changeset
|
367 add_node((GaimBlistNode*)buddy, ggblist); |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
368 } |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
369 |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
370 static void |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
371 buddy_signed_off(GaimBuddy *buddy, GGBlist *ggblist) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
372 { |
13861
55fb5cd9bac9
[gaim-migrate @ 16322]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
373 node_remove(gaim_get_blist(), (GaimBlistNode*)buddy); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
374 } |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
375 #endif |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
376 |
13857
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
377 GaimBlistUiOps *gg_blist_get_ui_ops() |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
378 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
379 return &blist_ui_ops; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
380 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
381 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
382 static void |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
383 selection_activate(GntWidget *widget, GGBlist *ggblist) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
384 { |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
385 GntTree *tree = GNT_TREE(ggblist->tree); |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
386 GaimBlistNode *node = gnt_tree_get_selection_data(tree); |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
387 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
388 if (!node) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
389 return; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
390 |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
391 if (GAIM_BLIST_NODE_IS_BUDDY(node)) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
392 { |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
393 GaimBuddy *buddy = (GaimBuddy *)node; |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
394 gaim_conversation_new(GAIM_CONV_TYPE_IM, |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
395 gaim_buddy_get_account(buddy), |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
396 gaim_buddy_get_name(buddy)); |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
397 } |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
398 else if (GAIM_BLIST_NODE_IS_CHAT(node)) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
399 { |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
400 GaimChat *chat = (GaimChat*)node; |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
401 serv_join_chat(chat->account->gc, chat->components); |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
402 } |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
403 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
404 |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
405 static void |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
406 remove_context_menu(GGBlist *ggblist) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
407 { |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
408 if (ggblist->context) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
409 gnt_widget_destroy(ggblist->context->parent); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
410 ggblist->context = NULL; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
411 ggblist->cnode = NULL; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
412 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
413 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
414 static void |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
415 gnt_append_menu_action(GntTree *tree, GaimMenuAction *action, gpointer parent) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
416 { |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
417 GList *list; |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
418 if (action == NULL) |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
419 return; |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
420 |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13959
diff
changeset
|
421 gnt_tree_add_row_after(tree, action, |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13959
diff
changeset
|
422 gnt_tree_create_row(tree, action->label), parent, NULL); |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
423 for (list = action->children; list; list = list->next) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
424 gnt_append_menu_action(tree, list->data, action); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
425 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
426 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
427 static void |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
428 append_proto_menu(GntTree *tree, GaimConnection *gc, GaimBlistNode *node) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
429 { |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
430 GList *list; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
431 GaimPluginProtocolInfo *prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
432 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
433 if(!prpl_info || !prpl_info->blist_node_menu) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
434 return; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
435 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
436 for(list = prpl_info->blist_node_menu(node); list; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
437 list = g_list_delete_link(list, list)) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
438 { |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
439 GaimMenuAction *act = (GaimMenuAction *) list->data; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
440 gnt_append_menu_action(tree, act, NULL); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
441 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
442 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
443 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
444 static void |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
445 add_custom_action(GntTree *tree, const char *label, GaimCallback callback, |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
446 gpointer data) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
447 { |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
448 GaimMenuAction *action = gaim_menu_action_new(label, callback, data, NULL); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
449 gnt_append_menu_action(tree, action, NULL); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
450 g_signal_connect_swapped(G_OBJECT(tree), "destroy", |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
451 G_CALLBACK(gaim_menu_action_free), action); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
452 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
453 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
454 static void |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
455 create_chat_menu(GntTree *tree, GaimChat *chat) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
456 { |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
457 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
458 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
459 static void |
14062
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
460 gg_add_buddy(GaimGroup *grp, GaimBlistNode *node) |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
461 { |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
462 gaim_blist_request_add_buddy(NULL, NULL, grp->name, NULL); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
463 } |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
464 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
465 static void |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
466 gg_add_group(GaimGroup *grp, GaimBlistNode *node) |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
467 { |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
468 gaim_blist_request_add_group(); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
469 } |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
470 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
471 static void |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
472 create_group_menu(GntTree *tree, GaimGroup *group) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
473 { |
14062
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
474 add_custom_action(tree, _("Add Buddy"), |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
475 GAIM_CALLBACK(gg_add_buddy), group); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
476 add_custom_action(tree, _("Add Group"), |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
477 GAIM_CALLBACK(gg_add_group), group); |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
478 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
479 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
480 static void |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
481 gg_blist_get_buddy_info_cb(GaimBuddy *buddy, GaimBlistNode *null) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
482 { |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
483 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
|
484 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
485 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
486 static void |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
487 create_buddy_menu(GntTree *tree, GaimBuddy *buddy) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
488 { |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
489 GaimPluginProtocolInfo *prpl_info; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
490 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
491 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(buddy->account->gc->prpl); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
492 if (prpl_info && prpl_info->get_info) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
493 { |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
494 add_custom_action(tree, _("Get Info"), |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
495 GAIM_CALLBACK(gg_blist_get_buddy_info_cb), buddy); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
496 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
497 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
498 #if 0 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
499 add_custom_action(tree, _("Add Buddy Pounce"), |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
500 GAIM_CALLBACK(gg_blist_add_buddy_pounce_cb)), buddy); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
501 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
502 if (prpl_info && prpl_info->send_file) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
503 { |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
504 if (!prpl_info->can_receive_file || |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
505 prpl_info->can_receive_file(buddy->account->gc, buddy->name)) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
506 add_custom_action(tree, _("Send File"), |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
507 GAIM_CALLBACK(gg_blist_show_file_cb)), buddy); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
508 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
509 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
510 add_custom_action(tree, _("View Log"), |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
511 GAIM_CALLBACK(gg_blist_view_log_cb)), buddy); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
512 #endif |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
513 |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
514 /* Protocol actions */ |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
515 append_proto_menu(tree, |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
516 gaim_account_get_connection(gaim_buddy_get_account(buddy)), |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
517 (GaimBlistNode*)buddy); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
518 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
519 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
520 static void |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
521 append_extended_menu(GntTree *tree, GaimBlistNode *node) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
522 { |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
523 GList *iter; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
524 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
525 for (iter = gaim_blist_node_get_extended_menu(node); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
526 iter; iter = g_list_delete_link(iter, iter)) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
527 { |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
528 gnt_append_menu_action(tree, iter->data, NULL); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
529 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
530 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
531 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
532 static void |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
533 context_menu_callback(GntTree *tree, GGBlist *ggblist) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
534 { |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
535 GaimMenuAction *action = gnt_tree_get_selection_data(tree); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
536 GaimBlistNode *node = ggblist->cnode; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
537 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
538 if (action) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
539 { |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
540 void (*callback)(GaimBlistNode *, gpointer); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
541 callback = (void (*)(GaimBlistNode *, gpointer))action->callback; |
14020
13e7ba964993
[gaim-migrate @ 16617]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14018
diff
changeset
|
542 if (callback) |
13e7ba964993
[gaim-migrate @ 16617]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14018
diff
changeset
|
543 callback(node, action->data); |
13e7ba964993
[gaim-migrate @ 16617]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14018
diff
changeset
|
544 else |
13e7ba964993
[gaim-migrate @ 16617]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14018
diff
changeset
|
545 return; |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
546 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
547 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
548 remove_context_menu(ggblist); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
549 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
550 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
551 static void |
14018
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
552 rename_blist_node(GaimBlistNode *node, const char *newname) |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
553 { |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
554 const char *name = newname; |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
555 if (name && !*name) |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
556 name = NULL; |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
557 |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
558 if (GAIM_BLIST_NODE_IS_BUDDY(node)) |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
559 gaim_blist_alias_buddy((GaimBuddy*)node, name); |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
560 else if (GAIM_BLIST_NODE_IS_CHAT(node)) |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
561 gaim_blist_alias_chat((GaimChat*)node, name); |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
562 else if (GAIM_BLIST_NODE_IS_GROUP(node)) |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
563 gaim_blist_rename_group((GaimGroup*)node, name); |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
564 else |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
565 g_return_if_reached(); |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
566 } |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
567 |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
568 static void |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
569 gg_blist_rename_node_cb(GaimBlistNode *node, GaimBlistNode *null) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
570 { |
14018
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
571 const char *name = NULL; |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
572 char *prompt; |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
573 |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
574 if (GAIM_BLIST_NODE_IS_BUDDY(node)) |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
575 name = gaim_buddy_get_contact_alias((GaimBuddy*)node); |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
576 else if (GAIM_BLIST_NODE_IS_CHAT(node)) |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
577 name = gaim_chat_get_name((GaimChat*)node); |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
578 else if (GAIM_BLIST_NODE_IS_GROUP(node)) |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
579 name = ((GaimGroup*)node)->name; |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
580 else |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
581 g_return_if_reached(); |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
582 |
14018
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
583 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
|
584 |
14018
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
585 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
|
586 name, FALSE, FALSE, NULL, _("Rename"), G_CALLBACK(rename_blist_node), |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
587 _("Cancel"), NULL, node); |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
588 |
35699556075f
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
589 g_free(prompt); |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
590 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
591 |
14063
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
592 /* Xeroxed from gtkdialogs.c:gaim_gtkdialogs_remove_group_cb*/ |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
593 static void |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
594 remove_group(GaimGroup *group) |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
595 { |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
596 GaimBlistNode *cnode, *bnode; |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
597 |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
598 cnode = ((GaimBlistNode*)group)->child; |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
599 |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
600 while (cnode) { |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
601 if (GAIM_BLIST_NODE_IS_CONTACT(cnode)) { |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
602 bnode = cnode->child; |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
603 cnode = cnode->next; |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
604 while (bnode) { |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
605 GaimBuddy *buddy; |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
606 if (GAIM_BLIST_NODE_IS_BUDDY(bnode)) { |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
607 buddy = (GaimBuddy*)bnode; |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
608 bnode = bnode->next; |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
609 if (gaim_account_is_connected(buddy->account)) { |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
610 gaim_account_remove_buddy(buddy->account, buddy, group); |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
611 gaim_blist_remove_buddy(buddy); |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
612 } |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
613 } else { |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
614 bnode = bnode->next; |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
615 } |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
616 } |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
617 } else if (GAIM_BLIST_NODE_IS_CHAT(cnode)) { |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
618 GaimChat *chat = (GaimChat *)cnode; |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
619 cnode = cnode->next; |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
620 if (gaim_account_is_connected(chat->account)) |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
621 gaim_blist_remove_chat(chat); |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
622 } else { |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
623 cnode = cnode->next; |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
624 } |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
625 } |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
626 |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
627 gaim_blist_remove_group(group); |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
628 } |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
629 |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
630 static void |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
631 gg_blist_remove_node(GaimBlistNode *node) |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
632 { |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
633 if (GAIM_BLIST_NODE_IS_BUDDY(node)) |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
634 { |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
635 GaimBuddy *buddy = (GaimBuddy*)node; |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
636 GaimGroup *group = gaim_buddy_get_group(buddy); |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
637 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
|
638 gaim_blist_remove_buddy(buddy); |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
639 } |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
640 else if (GAIM_BLIST_NODE_IS_CHAT(node)) |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
641 { |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
642 gaim_blist_remove_chat((GaimChat*)node); |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
643 } |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
644 else if (GAIM_BLIST_NODE_IS_GROUP(node)) |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
645 { |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
646 remove_group((GaimGroup*)node); |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
647 } |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
648 } |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
649 |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
650 static void |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
651 gg_blist_remove_node_cb(GaimBlistNode *node, GaimBlistNode *null) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
652 { |
14064
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
653 char *primary, *sec = NULL; |
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
654 const char *name; |
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
655 |
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
656 if (GAIM_BLIST_NODE_IS_BUDDY(node)) |
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
657 name = gaim_buddy_get_name((GaimBuddy*)node); |
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
658 else if (GAIM_BLIST_NODE_IS_CHAT(node)) |
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
659 name = gaim_chat_get_name((GaimChat*)node); |
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
660 else if (GAIM_BLIST_NODE_IS_GROUP(node)) |
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
661 { |
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
662 name = ((GaimGroup*)node)->name; |
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
663 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
|
664 } |
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
665 else |
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
666 return; |
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
667 |
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
668 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
|
669 |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
670 /* XXX: anything to do with the returned ui-handle? */ |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
671 gaim_request_action(node, _("Confirm Remove"), |
14064
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
672 primary, sec, |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
673 1, node, 2, |
14063
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
674 _("Remove"), gg_blist_remove_node, |
14064
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
675 _("Cancel"), NULL); |
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
676 g_free(primary); |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
677 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
678 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
679 static void |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
680 draw_context_menu(GGBlist *ggblist) |
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 GaimBlistNode *node = NULL; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
683 GntWidget *context = NULL, *window = NULL; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
684 GntTree *tree = NULL; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
685 int x, y, top, width; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
686 char *title = NULL; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
687 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
688 tree = GNT_TREE(ggblist->tree); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
689 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
690 if (ggblist->context) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
691 { |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
692 remove_context_menu(ggblist); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
693 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
694 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
695 node = gnt_tree_get_selection_data(tree); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
696 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
697 if (node == NULL) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
698 return; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
699 if (ggblist->tooltip) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
700 remove_tooltip(ggblist); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
701 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
702 ggblist->cnode = node; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
703 ggblist->context = context = gnt_tree_new(); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
704 GNT_WIDGET_SET_FLAGS(context, GNT_WIDGET_NO_BORDER); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
705 gnt_widget_set_name(context, "context menu"); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
706 g_signal_connect(G_OBJECT(context), "activate", G_CALLBACK(context_menu_callback), ggblist); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
707 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
708 if (GAIM_BLIST_NODE_IS_BUDDY(node)) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
709 { |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
710 GaimBuddy *buddy = (GaimBuddy *)node; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
711 create_buddy_menu(GNT_TREE(context), buddy); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
712 title = g_strdup(gaim_buddy_get_name(buddy)); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
713 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
714 else if (GAIM_BLIST_NODE_IS_CHAT(node)) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
715 { |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
716 GaimChat *chat = (GaimChat*)node; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
717 create_chat_menu(GNT_TREE(context), chat); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
718 title = g_strdup(gaim_chat_get_name(chat)); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
719 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
720 else if (GAIM_BLIST_NODE_IS_GROUP(node)) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
721 { |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
722 GaimGroup *group = (GaimGroup *)node; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
723 create_group_menu(GNT_TREE(context), group); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
724 title = g_strdup(group->name); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
725 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
726 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
727 append_extended_menu(GNT_TREE(context), node); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
728 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
729 /* These are common for everything */ |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
730 add_custom_action(GNT_TREE(context), _("Rename"), |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
731 GAIM_CALLBACK(gg_blist_rename_node_cb), node); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
732 add_custom_action(GNT_TREE(context), _("Remove"), |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
733 GAIM_CALLBACK(gg_blist_remove_node_cb), node); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
734 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
735 window = gnt_vbox_new(FALSE); |
14062
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
736 GNT_WIDGET_SET_FLAGS(window, GNT_WIDGET_TRANSIENT); |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
737 gnt_box_set_toplevel(GNT_BOX(window), TRUE); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
738 gnt_box_set_title(GNT_BOX(window), title); |
14020
13e7ba964993
[gaim-migrate @ 16617]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14018
diff
changeset
|
739 |
13e7ba964993
[gaim-migrate @ 16617]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14018
diff
changeset
|
740 gnt_widget_set_size(context, 0, g_list_length(GNT_TREE(context)->list)); |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
741 gnt_box_add_widget(GNT_BOX(window), context); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
742 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
743 /* Set the position for the popup */ |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
744 gnt_widget_get_position(GNT_WIDGET(tree), &x, &y); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
745 gnt_widget_get_size(GNT_WIDGET(tree), &width, NULL); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
746 top = gnt_tree_get_selection_visible_line(tree); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
747 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
748 x += width; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
749 y += top - 1; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
750 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
751 gnt_widget_set_position(window, x, y); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
752 gnt_widget_draw(window); |
13959
2ae35c0cf616
[gaim-migrate @ 16511]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13958
diff
changeset
|
753 g_free(title); |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
754 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
755 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
756 static void |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
757 draw_tooltip(GGBlist *ggblist) |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
758 { |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
759 GaimBlistNode *node; |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
760 int x, y, top, width; |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
761 GString *str; |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
762 GaimPlugin *prpl; |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
763 GaimPluginProtocolInfo *prpl_info; |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
764 GaimAccount *account; |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
765 GntTree *tree; |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
766 GntWidget *widget, *box; |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
767 char *title = NULL; |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
768 |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
769 widget = ggblist->tree; |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
770 tree = GNT_TREE(widget); |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
771 |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
772 if (!gnt_widget_has_focus(ggblist->tree)) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
773 return; |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
774 |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
775 if (ggblist->context) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
776 return; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
777 |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
778 if (ggblist->tooltip) |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
779 { |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13865
diff
changeset
|
780 /* 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
|
781 * to avoid the blinking*/ |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
782 remove_tooltip(ggblist); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
783 } |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
784 |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
785 node = gnt_tree_get_selection_data(tree); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
786 if (!node) |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
787 return; |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
788 |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
789 str = g_string_new(""); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
790 |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
791 if (GAIM_BLIST_NODE_IS_BUDDY(node)) |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
792 { |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
793 GaimBuddy *buddy = (GaimBuddy *)node; |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
794 account = gaim_buddy_get_account(buddy); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
795 |
13952
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
796 g_string_append_printf(str, _("Account: %s (%s)"), |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
797 gaim_account_get_username(account), |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
798 gaim_account_get_protocol_name(account)); |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
799 |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
800 prpl = gaim_find_prpl(gaim_account_get_protocol_id(account)); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
801 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
802 if (prpl_info && prpl_info->tooltip_text) |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
803 { |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
804 GString *tip = g_string_new(""); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
805 char *strip, *br; |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
806 prpl_info->tooltip_text(buddy, tip, TRUE); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
807 |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
808 br = gaim_strreplace(tip->str, "\n", "<br>"); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
809 strip = gaim_markup_strip_html(br); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
810 g_string_append(str, strip); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
811 g_string_free(tip, TRUE); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
812 g_free(strip); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
813 g_free(br); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
814 } |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
815 |
14065
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14064
diff
changeset
|
816 if (gaim_prefs_get_bool("/gaim/gnt/blist/idletime")) |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14064
diff
changeset
|
817 { |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14064
diff
changeset
|
818 GaimPresence *pre = gaim_buddy_get_presence(buddy); |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14064
diff
changeset
|
819 if (gaim_presence_is_idle(pre)) |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14064
diff
changeset
|
820 { |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14064
diff
changeset
|
821 time_t idle = gaim_presence_get_idle_time(pre); |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14064
diff
changeset
|
822 char *st = gaim_str_seconds_to_string(time(NULL) - idle); |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14064
diff
changeset
|
823 g_string_append_printf(str, _("\nIdle: %s"), st); |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14064
diff
changeset
|
824 g_free(st); |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14064
diff
changeset
|
825 } |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14064
diff
changeset
|
826 } |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14064
diff
changeset
|
827 |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
828 title = g_strdup(gaim_buddy_get_name(buddy)); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
829 } |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
830 else if (GAIM_BLIST_NODE_IS_GROUP(node)) |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
831 { |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
832 GaimGroup *group = (GaimGroup *)node; |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
833 |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
834 g_string_append_printf(str, _("Online: %d\nTotal: %d"), |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
835 gaim_blist_get_group_online_count(group), |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
836 gaim_blist_get_group_size(group, FALSE)); |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
837 |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
838 title = g_strdup(group->name); |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
839 } |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
840 else if (GAIM_BLIST_NODE_IS_CHAT(node)) |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
841 { |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
842 GaimChat *chat = (GaimChat *)node; |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
843 GaimAccount *account = chat->account; |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
844 |
13952
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
845 g_string_append_printf(str, _("Account: %s (%s)"), |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
846 gaim_account_get_username(account), |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
847 gaim_account_get_protocol_name(account)); |
13884
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
848 |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
849 title = g_strdup(gaim_chat_get_name(chat)); |
eac18261c6f0
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13877
diff
changeset
|
850 } |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
851 else |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
852 { |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
853 g_string_free(str, TRUE); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
854 return; |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
855 } |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
856 |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
857 gnt_widget_get_position(widget, &x, &y); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
858 gnt_widget_get_size(widget, &width, NULL); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
859 top = gnt_tree_get_selection_visible_line(tree); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
860 |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
861 x += width; |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
862 y += top - 1; |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
863 |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
864 box = gnt_box_new(FALSE, FALSE); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
865 gnt_box_set_toplevel(GNT_BOX(box), TRUE); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
866 GNT_WIDGET_SET_FLAGS(box, GNT_WIDGET_NO_SHADOW); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
867 gnt_box_set_title(GNT_BOX(box), title); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
868 |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
869 gnt_box_add_widget(GNT_BOX(box), gnt_label_new(str->str)); |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
870 |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
871 gnt_widget_set_position(box, x, y); |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
872 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
|
873 GNT_WIDGET_SET_FLAGS(box, GNT_WIDGET_TRANSIENT); |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
874 gnt_widget_draw(box); |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
875 |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
876 g_free(title); |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
877 g_string_free(str, TRUE); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
878 ggblist->tooltip = box; |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
879 ggblist->tnode = node; |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13865
diff
changeset
|
880 |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13865
diff
changeset
|
881 gnt_widget_set_name(ggblist->tooltip, "tooltip"); |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
882 } |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
883 |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
884 static void |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
885 selection_changed(GntWidget *widget, gpointer old, gpointer current, GGBlist *ggblist) |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
886 { |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
887 draw_tooltip(ggblist); |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
888 } |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
889 |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
890 static gboolean |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
891 key_pressed(GntWidget *widget, const char *text, GGBlist *ggblist) |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
892 { |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
893 gboolean stop = FALSE, ret = FALSE; |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
894 if (text[0] == 27 && text[1] == 0) |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
895 { |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
896 /* Escape was pressed */ |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
897 remove_peripherals(ggblist); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
898 stop = TRUE; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
899 ret = TRUE; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
900 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
901 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
902 if (ggblist->context) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
903 { |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
904 ret = gnt_widget_key_pressed(ggblist->context, text); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
905 stop = TRUE; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
906 } |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
907 |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
908 if (text[0] == 27) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
909 { |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
910 if (strcmp(text + 1, GNT_KEY_POPUP) == 0) |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
911 { |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
912 draw_context_menu(ggblist); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
913 stop = TRUE; |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
914 ret = TRUE; |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
915 } |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
916 } |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13884
diff
changeset
|
917 |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
918 if (stop) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
919 g_signal_stop_emission_by_name(G_OBJECT(widget), "key_pressed"); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
920 |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
921 return ret; |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
922 } |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
923 |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
924 static void |
13931
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
925 update_buddy_display(GaimBuddy *buddy, GGBlist *ggblist) |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
926 { |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13959
diff
changeset
|
927 gnt_tree_change_text(GNT_TREE(ggblist->tree), buddy, 0, get_display_name((GaimBlistNode*)buddy)); |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
928 if (ggblist->tnode == (GaimBlistNode*)buddy) |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
929 draw_tooltip(ggblist); |
13931
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
930 |
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
931 if (gaim_presence_is_idle(gaim_buddy_get_presence(buddy))) |
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
932 gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), buddy, GNT_TEXT_FLAG_DIM); |
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
933 else |
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
934 gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), buddy, 0); |
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
935 } |
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
936 |
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
937 static void |
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
938 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
|
939 { |
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
940 update_buddy_display(buddy, ggblist); |
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
941 } |
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
942 |
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
943 static void |
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
944 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
|
945 { |
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
946 update_buddy_display(buddy, ggblist); |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
947 } |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
948 |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
949 static void |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
950 remove_peripherals(GGBlist *ggblist) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
951 { |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
952 if (ggblist->tooltip) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
953 remove_tooltip(ggblist); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
954 else if (ggblist->context) |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
955 remove_context_menu(ggblist); |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
956 } |
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
957 |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
958 static void |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
959 size_changed_cb(GntWidget *w, int width, int height) |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
960 { |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
961 gaim_prefs_set_int(PREF_ROOT "/size/width", width); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
962 gaim_prefs_set_int(PREF_ROOT "/size/height", height); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
963 } |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
964 |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
965 static void |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
966 save_position_cb(GntWidget *w, int x, int y) |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
967 { |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
968 gaim_prefs_set_int(PREF_ROOT "/position/x", x); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
969 gaim_prefs_set_int(PREF_ROOT "/position/y", y); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
970 } |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
971 |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
972 static void |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
973 reset_blist_window(GntWidget *window, gpointer null) |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
974 { |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
975 GaimBlistNode *node; |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
976 gaim_signals_disconnect_by_handle(gg_blist_get_handle()); |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
977 gaim_get_blist()->ui_data = NULL; |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
978 |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
979 node = gaim_blist_get_root(); |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
980 while (node) |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
981 { |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
982 node->ui_data = NULL; |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
983 node = gaim_blist_node_next(node, TRUE); |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
984 } |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
985 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
986 remove_typing_cb(NULL); |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
987 remove_peripherals(ggblist); |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
988 g_free(ggblist); |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
989 ggblist = NULL; |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
990 } |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
991 |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
992 static void |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
993 populate_buddylist() |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
994 { |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
995 GaimBlistNode *node; |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
996 GaimBuddyList *list; |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
997 |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
998 list = gaim_get_blist(); |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
999 node = gaim_blist_get_root(); |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1000 while (node) |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1001 { |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1002 node_update(list, node); |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1003 node = gaim_blist_node_next(node, FALSE); |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1004 } |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1005 } |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1006 |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1007 static void |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1008 destroy_status_list(GList *list) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1009 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1010 g_list_foreach(list, (GFunc)g_free, NULL); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1011 g_list_free(list); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1012 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1013 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1014 static void |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1015 populate_status_dropdown() |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1016 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1017 int i; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1018 GList *iter; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1019 GList *items = NULL; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1020 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1021 /* First the primitives */ |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1022 GaimStatusPrimitive prims[] = {GAIM_STATUS_AVAILABLE, GAIM_STATUS_AWAY, |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1023 GAIM_STATUS_INVISIBLE, GAIM_STATUS_OFFLINE, GAIM_STATUS_UNSET}; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1024 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1025 for (i = 0; prims[i] != GAIM_STATUS_UNSET; i++) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1026 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1027 StatusBoxItem *item = g_new0(StatusBoxItem, 1); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1028 item->type = STATUS_PRIMITIVE; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1029 item->u.prim = prims[i]; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1030 items = g_list_prepend(items, item); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1031 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
|
1032 gaim_primitive_get_name_from_type(prims[i])); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1033 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1034 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1035 /* Now the popular statuses */ |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1036 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
|
1037 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1038 StatusBoxItem *item = g_new0(StatusBoxItem, 1); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1039 item->type = STATUS_SAVED; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1040 item->u.saved = iter->data; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1041 items = g_list_prepend(items, item); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1042 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
|
1043 gaim_savedstatus_get_title(iter->data)); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1044 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1045 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1046 /* 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
|
1047 * 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
|
1048 * is destroyed. */ |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1049 g_object_set_data_full(G_OBJECT(ggblist->status), "list of statuses", items, (GDestroyNotify)destroy_status_list); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1050 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1051 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1052 void gg_blist_init() |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1053 { |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1054 gaim_prefs_add_none(PREF_ROOT); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1055 gaim_prefs_add_none(PREF_ROOT "/size"); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1056 gaim_prefs_add_int(PREF_ROOT "/size/width", 20); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1057 gaim_prefs_add_int(PREF_ROOT "/size/height", 20); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1058 gaim_prefs_add_none(PREF_ROOT "/position"); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1059 gaim_prefs_add_int(PREF_ROOT "/position/x", 0); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1060 gaim_prefs_add_int(PREF_ROOT "/position/y", 0); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1061 |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1062 gg_blist_show(); |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1063 |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1064 return; |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1065 } |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1066 |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14042
diff
changeset
|
1067 static gboolean |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1068 remove_typing_cb(gpointer null) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1069 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1070 GaimSavedStatus *current; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1071 const char *message, *newmessage; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1072 GaimStatusPrimitive prim, newprim; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1073 StatusBoxItem *item; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1074 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1075 current = gaim_savedstatus_get_current(); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1076 message = gaim_savedstatus_get_message(current); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1077 prim = gaim_savedstatus_get_type(current); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1078 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1079 newmessage = gnt_entry_get_text(GNT_ENTRY(ggblist->statustext)); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1080 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
|
1081 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
|
1082 newprim = item->u.prim; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1083 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1084 if (newprim != prim || ((message && !newmessage) || |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1085 (!message && newmessage) || |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1086 (message && newmessage && g_utf8_collate(message, newmessage) != 0))) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1087 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1088 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
|
1089 /* Holy Crap! That's a LAWNG function name */ |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1090 if (status == NULL) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1091 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1092 status = gaim_savedstatus_new(NULL, newprim); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1093 gaim_savedstatus_set_message(status, newmessage); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1094 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1095 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1096 gaim_savedstatus_activate(status); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1097 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1098 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1099 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
|
1100 if (ggblist->typing) |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
1101 g_source_remove(ggblist->typing); |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1102 ggblist->typing = 0; |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14042
diff
changeset
|
1103 return FALSE; |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1104 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1105 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1106 static void |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1107 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
|
1108 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1109 gnt_entry_set_text(GNT_ENTRY(ggblist->statustext), NULL); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1110 if (now->type == STATUS_SAVED) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1111 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1112 /* Set the status immediately */ |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1113 gaim_savedstatus_activate(now->u.saved); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1114 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1115 else if (now->type == STATUS_PRIMITIVE) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1116 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1117 /* Move the focus to the entry box */ |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
1118 /* 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
|
1119 gnt_box_move_focus(GNT_BOX(ggblist->window), 1); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1120 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
|
1121 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1122 else |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1123 g_return_if_reached(); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1124 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1125 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1126 static gboolean |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1127 status_text_changed(GntEntry *entry, const char *text, gpointer null) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1128 { |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14042
diff
changeset
|
1129 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
|
1130 return FALSE; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1131 |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
1132 if (ggblist->typing) |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
1133 g_source_remove(ggblist->typing); |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1134 ggblist->typing = 0; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1135 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1136 if (text[0] == '\r' && text[1] == 0) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1137 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1138 /* Set the status only after you press 'Enter' */ |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1139 remove_typing_cb(NULL); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1140 return TRUE; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1141 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1142 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1143 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
|
1144 return FALSE; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1145 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1146 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1147 static void |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1148 savedstatus_changed(GaimSavedStatus *now, GaimSavedStatus *old) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1149 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1150 /* Block the signals we don't want to emit */ |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1151 GList *list; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1152 GaimStatusPrimitive prim; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1153 const char *message; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1154 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1155 if (!ggblist) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1156 return; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1157 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1158 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
|
1159 0, 0, NULL, status_selection_changed, NULL); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1160 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
|
1161 0, 0, NULL, status_text_changed, NULL); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1162 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1163 prim = gaim_savedstatus_get_type(now); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1164 message = gaim_savedstatus_get_message(now); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1165 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1166 list = g_object_get_data(G_OBJECT(ggblist->status), "list of statuses"); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1167 for (; list; list = list->next) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1168 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1169 StatusBoxItem *item = list->data; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1170 if (item->type == STATUS_PRIMITIVE && item->u.prim == prim) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1171 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1172 gnt_combo_box_set_selected(GNT_COMBO_BOX(ggblist->status), item); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1173 gnt_entry_set_text(GNT_ENTRY(ggblist->statustext), message); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1174 gnt_widget_draw(ggblist->status); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1175 break; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1176 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1177 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1178 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1179 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
|
1180 0, 0, NULL, status_selection_changed, NULL); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1181 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
|
1182 0, 0, NULL, status_text_changed, NULL); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1183 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1184 |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1185 void gg_blist_show() |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1186 { |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1187 if (ggblist) |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1188 return; |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1189 |
13857
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
1190 ggblist = g_new0(GGBlist, 1); |
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
1191 |
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
1192 gaim_get_blist()->ui_data = ggblist; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1193 |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1194 ggblist->window = gnt_vbox_new(FALSE); |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13865
diff
changeset
|
1195 gnt_widget_set_name(ggblist->window, "buddylist"); |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1196 gnt_box_set_toplevel(GNT_BOX(ggblist->window), TRUE); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1197 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
|
1198 gnt_box_set_pad(GNT_BOX(ggblist->window), 0); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1199 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1200 ggblist->tree = gnt_tree_new(); |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
1201 GNT_WIDGET_SET_FLAGS(ggblist->tree, GNT_WIDGET_NO_BORDER); |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13959
diff
changeset
|
1202 gnt_tree_set_col_width(GNT_TREE(ggblist->tree), 0, 25); |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1203 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
|
1204 gaim_prefs_get_int(PREF_ROOT "/size/height")); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1205 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
|
1206 gaim_prefs_get_int(PREF_ROOT "/position/y")); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1207 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1208 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
|
1209 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1210 gnt_box_add_widget(GNT_BOX(ggblist->window), gnt_hline_new()); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1211 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1212 ggblist->status = gnt_combo_box_new(); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1213 gnt_box_add_widget(GNT_BOX(ggblist->window), ggblist->status); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1214 ggblist->statustext = gnt_entry_new(NULL); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1215 gnt_box_add_widget(GNT_BOX(ggblist->window), ggblist->statustext); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1216 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1217 populate_status_dropdown(); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1218 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1219 gnt_widget_show(ggblist->window); |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
1220 |
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
1221 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
|
1222 GAIM_CALLBACK(buddy_status_changed), ggblist); |
13931
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1223 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
|
1224 GAIM_CALLBACK(buddy_idle_changed), ggblist); |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1225 |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13861
diff
changeset
|
1226 #if 0 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1227 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
|
1228 GAIM_CALLBACK(buddy_signed_on), ggblist); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1229 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
|
1230 GAIM_CALLBACK(buddy_signed_off), ggblist); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1231 |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1232 /* These I plan to use to indicate unread-messages etc. */ |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1233 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
|
1234 GAIM_CALLBACK(received_im_msg), list); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1235 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
|
1236 GAIM_CALLBACK(sent_im_msg), NULL); |
13857
d341b5ac1a78
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13853
diff
changeset
|
1237 |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1238 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
|
1239 GAIM_CALLBACK(received_chat_msg), list); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1240 #endif |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1241 |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1242 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
|
1243 g_signal_connect(G_OBJECT(ggblist->tree), "key_pressed", G_CALLBACK(key_pressed), ggblist); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
1244 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
|
1245 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
|
1246 ggblist, 0, G_CONNECT_AFTER | G_CONNECT_SWAPPED); |
13958
6741419af7f7
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
1247 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
|
1248 ggblist, 0, G_CONNECT_AFTER | G_CONNECT_SWAPPED); |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1249 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
|
1250 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
|
1251 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
|
1252 |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1253 /* Status signals */ |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1254 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
|
1255 GAIM_CALLBACK(savedstatus_changed), NULL); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1256 g_signal_connect(G_OBJECT(ggblist->status), "selection_changed", |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1257 G_CALLBACK(status_selection_changed), NULL); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1258 g_signal_connect(G_OBJECT(ggblist->statustext), "key_pressed", |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1259 G_CALLBACK(status_text_changed), NULL); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1260 |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1261 populate_buddylist(); |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1262 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
1263 savedstatus_changed(gaim_savedstatus_get_current(), NULL); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1264 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1265 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1266 void gg_blist_uninit() |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1267 { |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1268 if (ggblist == NULL) |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1269 return; |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14020
diff
changeset
|
1270 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1271 gnt_widget_destroy(ggblist->window); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1272 g_free(ggblist); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1273 ggblist = NULL; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1274 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1275 |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
1276 void gg_blist_get_position(int *x, int *y) |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
1277 { |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
1278 gnt_widget_get_position(ggblist->window, x, y); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
1279 } |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1280 |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
1281 void gg_blist_set_position(int x, int y) |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
1282 { |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
1283 gnt_widget_set_position(ggblist->window, x, y); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
1284 } |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
1285 |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
1286 void gg_blist_get_size(int *width, int *height) |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
1287 { |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
1288 gnt_widget_get_size(ggblist->window, width, height); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
1289 } |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
1290 |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
1291 void gg_blist_set_size(int width, int height) |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
1292 { |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
1293 gnt_widget_set_size(ggblist->window, width, height); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
1294 } |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
1295 |