Mercurial > pidgin
annotate src/buddy.c @ 4425:be8f9ca74ddf
[gaim-migrate @ 4700]
Gaim should no longer crash when the user is NULL and the conversation is
closed. This happened for instance when a user typed /part in an IRC
channel and then closed the tab.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Sun, 26 Jan 2003 07:17:07 +0000 |
parents | 04d2e57b22c5 |
children | 78a2d2e7f4b5 |
rev | line source |
---|---|
1 | 1 /* |
2 * gaim | |
3 * | |
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 * | |
20 */ | |
21 | |
349
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
342
diff
changeset
|
22 #ifdef HAVE_CONFIG_H |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2048
diff
changeset
|
23 #include <config.h> |
349
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
342
diff
changeset
|
24 #endif |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
25 #ifdef GAIM_PLUGINS |
3630 | 26 #ifndef _WIN32 |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
27 #include <dlfcn.h> |
3630 | 28 #endif |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
29 #endif /* GAIM_PLUGINS */ |
1 | 30 #include <string.h> |
31 #include <stdio.h> | |
32 #include <stdlib.h> | |
3159 | 33 #include <ctype.h> |
1 | 34 #include <math.h> |
35 #include <time.h> | |
3630 | 36 #include <ctype.h> |
37 | |
38 #ifdef _WIN32 | |
39 #include <gdk/gdkwin32.h> | |
40 #else | |
1233
728a90516211
[gaim-migrate @ 1243]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1230
diff
changeset
|
41 #include <unistd.h> |
3630 | 42 #include <gdk/gdkx.h> |
43 #endif | |
1 | 44 |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
45 #include <gdk/gdkkeysyms.h> |
1 | 46 #include <gtk/gtk.h> |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
47 #include "prpl.h" |
1 | 48 #include "gaim.h" |
3630 | 49 |
50 #ifdef _WIN32 | |
51 #include "win32dep.h" | |
52 #endif | |
53 | |
1 | 54 #include "pixmaps/login_icon.xpm" |
55 #include "pixmaps/logout_icon.xpm" | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
56 #include "pixmaps/no_icon.xpm" |
1 | 57 |
1929
d51ea669d84e
[gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1918
diff
changeset
|
58 #include "pixmaps/away_big.xpm" |
1 | 59 |
875 | 60 #include "pixmaps/group.xpm" |
820 | 61 |
3131 | 62 #include "pixmaps/arrow_down.xpm" |
63 #include "pixmaps/arrow_right.xpm" | |
64 | |
1 | 65 static GtkTooltips *tips; |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
66 static GtkAccelGroup *accel; |
1 | 67 static GtkWidget *editpane; |
68 static GtkWidget *buddypane; | |
696
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
69 static GtkWidget *imchatbox; |
1 | 70 static GtkWidget *edittree; |
1929
d51ea669d84e
[gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1918
diff
changeset
|
71 static GtkWidget *imbutton, *infobutton, *chatbutton, *awaybutton; |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
72 static GtkWidget *addbutton, *groupbutton, *rembutton; |
1 | 73 |
74 GtkWidget *blist = NULL; | |
75 GtkWidget *bpmenu; | |
76 GtkWidget *buddies; | |
77 | |
3131 | 78 typedef struct _GtkTreePixmaps GtkTreePixmaps; |
79 | |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
80 struct buddy_show { |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
81 GtkWidget *item; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
82 GtkWidget *pix; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
83 GtkWidget *label; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
84 GtkWidget *warn; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
85 GtkWidget *idle; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
86 char *name; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
87 GSList *connlist; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
88 guint log_timer; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
89 gint sound; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
90 }; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
91 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
92 /* stuff for actual display of buddy list */ |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
93 struct group_show { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
94 GtkWidget *item; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
95 GtkWidget *label; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
96 GtkWidget *tree; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
97 GSList *members; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
98 char *name; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
99 }; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
100 static GSList *shows = NULL; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
101 |
3524 | 102 int docklet_count = 0; |
3939 | 103 static gboolean obscured = FALSE; |
3472 | 104 |
2564 | 105 /* Predefine some functions */ |
2569
a714b8223228
[gaim-migrate @ 2582]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2564
diff
changeset
|
106 static void new_bp_callback(GtkWidget *w, struct buddy *bs); |
1069
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
107 static struct group_show *find_group_show(char *group); |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
108 static struct buddy_show *find_buddy_show(struct group_show *gs, char *name); |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
109 static int group_number(char *group); |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
110 static int buddy_number(char *group, char *buddy); |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
111 static struct group_show *new_group_show(char *group); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
112 static struct buddy_show *new_buddy_show(struct group_show *gs, struct buddy *buddy, char **xpm); |
1108
cb338aa38e78
[gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
113 static void remove_buddy_show(struct group_show *gs, struct buddy_show *bs); |
1069
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
114 static struct group_show *find_gs_by_bs(struct buddy_show *b); |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
115 static void update_num_group(struct group_show *gs); |
2624
4d5c2c913750
[gaim-migrate @ 2637]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
116 static void update_idle_time(struct buddy_show *bs); |
1 | 117 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
118 void handle_group_rename(struct group *g, char *prevname) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
119 { |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
120 struct group_show *gs, *new_gs; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
121 GtkCTreeNode *c; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
122 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
123 c = gtk_ctree_find_by_row_data(GTK_CTREE(edittree), NULL, g); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
124 gtk_ctree_node_set_text(GTK_CTREE(edittree), c, 0, g->name); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
125 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
126 gs = find_group_show(prevname); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
127 if (!gs) { |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
128 return; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
129 } |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
130 new_gs = find_group_show(g->name); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
131 if (new_gs) { |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
132 /* transfer everything that was in gs and is in the same gaim_conn as g |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
133 * over to new_gs. */ |
4349 | 134 while (gs->members) { |
135 new_gs->members = g_slist_append(new_gs->members, gs->members->data); | |
136 gs->members = g_slist_remove(gs->members, gs->members->data); | |
137 | |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
138 } |
4349 | 139 shows = g_slist_remove(shows, gs); |
140 gtk_tree_remove_item(GTK_TREE(buddies), gs->item); | |
141 g_free(gs->name); | |
142 g_free(gs); | |
1748
2eec724fdbcd
[gaim-migrate @ 1758]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1739
diff
changeset
|
143 update_num_group(new_gs); |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
144 } else { |
4349 | 145 g_free(gs->name); |
146 gs->name = g_strdup(g->name); | |
147 update_num_group(gs); | |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
148 } |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
149 } |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
150 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
151 void handle_buddy_rename(struct buddy *b, char *prevname) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
152 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
153 struct gaim_conversation *cnv; |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
154 struct buddy_show *bs; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
155 struct group_show *gs; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
156 struct group *g; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
157 GtkCTreeNode *c; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
158 char buf[256]; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
159 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
160 c = gtk_ctree_find_by_row_data(GTK_CTREE(edittree), NULL, b); |
4227 | 161 if (get_buddy_alias_only(b)) |
162 g_snprintf(buf, sizeof(buf), "%s (%s)", b->name, get_buddy_alias(b)); | |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
163 else |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
164 g_snprintf(buf, sizeof(buf), "%s", b->name); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
165 gtk_ctree_node_set_text(GTK_CTREE(edittree), c, 0, buf); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
166 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
167 if ((cnv = gaim_find_conversation(b->name)) != NULL) |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
168 gaim_conversation_autoset_title(cnv); |
2787
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2780
diff
changeset
|
169 |
4349 | 170 g = find_group_by_buddy(b); |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
171 if (!g) { |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
172 /* shouldn't happen */ |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
173 return; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
174 } |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
175 gs = find_group_show(g->name); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
176 if (!gs) { |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
177 return; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
178 } |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
179 bs = find_buddy_show(gs, prevname); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
180 if (!bs) { |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
181 /* buddy's offline */ |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
182 return; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
183 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
184 |
2275
f7bf34a3b535
[gaim-migrate @ 2285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2255
diff
changeset
|
185 if (g_strcasecmp(b->name, prevname)) { |
4349 | 186 bs->connlist = g_slist_remove(bs->connlist, b->user->gc); |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
187 if (!bs->connlist) { |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
188 gs->members = g_slist_remove(gs->members, bs); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
189 if (bs->log_timer > 0) |
4168 | 190 g_source_remove(bs->log_timer); |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
191 bs->log_timer = 0; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
192 remove_buddy_show(gs, bs); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
193 g_free(bs->name); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
194 g_free(bs); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
195 } |
2778
27c22147e023
[gaim-migrate @ 2791]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2736
diff
changeset
|
196 update_num_group(gs); |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
197 } else { |
4227 | 198 gtk_label_set_text(GTK_LABEL(bs->label), get_buddy_alias(b)); |
2624
4d5c2c913750
[gaim-migrate @ 2637]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
199 update_idle_time(bs); |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
200 } |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
201 } |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
202 |
1 | 203 void destroy_buddy() |
204 { | |
2380
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
205 GSList *s = shows; |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
206 struct group_show *g; |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
207 GSList *m; |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
208 struct buddy_show *b; |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
209 while (s) { |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
210 g = (struct group_show *)s->data; |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
211 debug_printf("group_show still exists: %s\n", g->name); |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
212 m = g->members; |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
213 while (m) { |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
214 b = (struct buddy_show *)m->data; |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
215 debug_printf("buddy_show still exists: %s\n", b->name); |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
216 m = g_slist_remove(m, b); |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
217 if (b->log_timer > 0) |
4168 | 218 g_source_remove(b->log_timer); |
2380
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
219 b->log_timer = 0; |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
220 gtk_tree_remove_item(GTK_TREE(g->tree), b->item); |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
221 g_free(b->name); |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
222 g_free(b); |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
223 } |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
224 gtk_tree_remove_item(GTK_TREE(buddies), g->item); |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
225 s = g_slist_remove(s, g); |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
226 g_free(g->name); |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
227 g_free(g); |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
228 } |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
229 shows = NULL; |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
230 |
1 | 231 if (blist) |
232 gtk_widget_destroy(blist); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
233 blist = NULL; |
700
d904bf694bd7
[gaim-migrate @ 710]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
696
diff
changeset
|
234 imchatbox = NULL; |
1544
f7bef430ccd1
[gaim-migrate @ 1554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1509
diff
changeset
|
235 awaymenu = NULL; |
f7bef430ccd1
[gaim-migrate @ 1554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1509
diff
changeset
|
236 protomenu = NULL; |
1 | 237 } |
238 | |
239 static void adjust_pic(GtkWidget *button, const char *c, gchar **xpm) | |
240 { | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
241 GdkPixmap *pm; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
242 GdkBitmap *bm; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
243 GtkWidget *pic; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
244 GtkWidget *label; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
245 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
246 /*if the user had opted to put pictures on the buttons */ |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
247 if (blist_options & OPT_BLIST_SHOW_BUTTON_XPM && xpm) { |
820 | 248 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, NULL, xpm); |
1 | 249 pic = gtk_pixmap_new(pm, bm); |
250 gtk_widget_show(pic); | |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
251 gdk_pixmap_unref(pm); |
804
17def2bb9720
[gaim-migrate @ 814]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
803
diff
changeset
|
252 gdk_bitmap_unref(bm); |
1 | 253 label = GTK_BIN(button)->child; |
254 gtk_container_remove(GTK_CONTAINER(button), label); | |
255 gtk_container_add(GTK_CONTAINER(button), pic); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
256 } else { |
1 | 257 label = gtk_label_new(c); |
258 gtk_widget_show(label); | |
259 pic = GTK_BIN(button)->child; | |
260 gtk_container_remove(GTK_CONTAINER(button), pic); | |
261 gtk_container_add(GTK_CONTAINER(button), label); | |
262 } | |
263 | |
264 } | |
265 | |
3869 | 266 /* This will remain here until we phase out the others */ |
267 static void adjust_pic2(GtkWidget *button, const char *c, gchar *icon) | |
268 { | |
269 GtkWidget *pic; | |
270 GtkWidget *label; | |
271 | |
272 /*if the user had opted to put pictures on the buttons */ | |
273 if (blist_options & OPT_BLIST_SHOW_BUTTON_XPM && icon) { | |
274 label = GTK_BIN(button)->child; | |
275 gtk_container_remove(GTK_CONTAINER(button), label); | |
276 gtk_container_add(GTK_CONTAINER(button), gtk_image_new_from_stock(icon, GTK_ICON_SIZE_BUTTON)); | |
277 gtk_widget_show_all(button); | |
278 } else { | |
279 label = gtk_label_new(c); | |
280 gtk_widget_show(label); | |
281 pic = GTK_BIN(button)->child; | |
282 gtk_container_remove(GTK_CONTAINER(button), pic); | |
283 gtk_container_add(GTK_CONTAINER(button), label); | |
284 } | |
285 | |
286 } | |
287 | |
1 | 288 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
289 void toggle_show_empty_groups() |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
290 { |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2281
diff
changeset
|
291 if (blist_options & OPT_BLIST_NO_MT_GRP) { |
1072
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
292 /* remove any group_shows with empty members */ |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
293 GSList *s = shows; |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
294 struct group_show *g; |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
295 |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
296 while (s) { |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
297 g = (struct group_show *)s->data; |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
298 if (!g_slist_length(g->members)) { |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
299 shows = g_slist_remove(shows, g); |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
300 s = shows; |
1108
cb338aa38e78
[gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
301 gtk_tree_remove_item(GTK_TREE(buddies), g->item); |
1072
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
302 g_free(g->name); |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
303 g_free(g); |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
304 } else |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
305 s = g_slist_next(s); |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
306 } |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
307 |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
308 } else { |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
309 /* put back all groups */ |
4349 | 310 GSList *m = groups; |
311 | |
312 while (m) { | |
313 struct group *g = (struct group *)m->data; | |
314 if (!find_group_show(g->name) && gaim_group_on_account(g, NULL)) | |
315 new_group_show(g->name); | |
316 m = g_slist_next(m); | |
1072
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
317 } |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
318 } |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
319 } |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
320 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
321 void toggle_buddy_pixmaps() |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
322 { |
1711
9b86520e04ac
[gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1699
diff
changeset
|
323 GSList *s = shows; |
9b86520e04ac
[gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1699
diff
changeset
|
324 struct group_show *g; |
9b86520e04ac
[gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1699
diff
changeset
|
325 GSList *m; |
9b86520e04ac
[gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1699
diff
changeset
|
326 struct buddy_show *b; |
9b86520e04ac
[gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1699
diff
changeset
|
327 |
9b86520e04ac
[gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1699
diff
changeset
|
328 while (s) { |
9b86520e04ac
[gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1699
diff
changeset
|
329 g = s->data; |
9b86520e04ac
[gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1699
diff
changeset
|
330 m = g->members; |
9b86520e04ac
[gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1699
diff
changeset
|
331 while (m) { |
9b86520e04ac
[gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1699
diff
changeset
|
332 b = m->data; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2281
diff
changeset
|
333 if (blist_options & OPT_BLIST_SHOW_PIXMAPS) |
1711
9b86520e04ac
[gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1699
diff
changeset
|
334 gtk_widget_show(b->pix); |
9b86520e04ac
[gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1699
diff
changeset
|
335 else |
9b86520e04ac
[gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1699
diff
changeset
|
336 gtk_widget_hide(b->pix); |
9b86520e04ac
[gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1699
diff
changeset
|
337 m = m->next; |
9b86520e04ac
[gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1699
diff
changeset
|
338 } |
9b86520e04ac
[gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1699
diff
changeset
|
339 s = s->next; |
9b86520e04ac
[gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1699
diff
changeset
|
340 } |
9b86520e04ac
[gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1699
diff
changeset
|
341 } |
9b86520e04ac
[gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1699
diff
changeset
|
342 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
343 static void update_num_group(struct group_show *gs) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
344 { |
1070
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
345 GSList *c = connections; |
4349 | 346 struct group *g = find_group(gs->name); |
347 struct buddy *b; | |
1070
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
348 int total = 0, on = 0; |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
349 char buf[256]; |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
350 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
351 if (!g_slist_find(shows, gs)) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
352 debug_printf("update_num_group called for unfound group_show %s\n", gs->name); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
353 return; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
354 } |
4349 | 355 if (g) { |
356 for (c = g->members; c; c = c->next) { | |
357 b = c->data; | |
358 if(b->user->gc) { | |
359 if(b->present) | |
360 on++; | |
361 total++; | |
362 } | |
1070
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
363 } |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
364 } |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
365 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2281
diff
changeset
|
366 if (blist_options & OPT_BLIST_SHOW_GRPNUM) |
1070
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
367 g_snprintf(buf, sizeof buf, "%s (%d/%d)", gs->name, on, total); |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
368 else |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
369 g_snprintf(buf, sizeof buf, "%s", gs->name); |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
370 |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
371 gtk_label_set_text(GTK_LABEL(gs->label), buf); |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
372 } |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
373 |
2883
c12e3e66d54a
[gaim-migrate @ 2896]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2856
diff
changeset
|
374 void update_num_groups(void) |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
375 { |
1070
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
376 GSList *s = shows; |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
377 struct group_show *g; |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
378 |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
379 while (s) { |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
380 g = (struct group_show *)s->data; |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
381 update_num_group(g); |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
382 s = g_slist_next(s); |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
383 } |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
384 } |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
385 |
1 | 386 void update_button_pix() |
387 { | |
388 | |
3894 | 389 adjust_pic2(addbutton, _("Add"), GTK_STOCK_ADD); |
875 | 390 adjust_pic(groupbutton, _("Group"), (gchar **)group_xpm); |
3894 | 391 adjust_pic2(rembutton, _("Remove"), GTK_STOCK_REMOVE); |
875 | 392 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2281
diff
changeset
|
393 if (!(blist_options & OPT_BLIST_NO_BUTTONS)) { |
1963 | 394 adjust_pic(awaybutton, _("Away"), (gchar **)away_big_xpm); |
3869 | 395 adjust_pic2(chatbutton, _("Chat"), GTK_STOCK_JUMP_TO); |
396 adjust_pic2(imbutton, _("IM"), GTK_STOCK_CONVERT); | |
397 adjust_pic2(infobutton, _("Info"), GTK_STOCK_FIND); | |
820 | 398 } |
544
53a85529d670
[gaim-migrate @ 554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
399 gtk_widget_hide(addbutton->parent); |
53a85529d670
[gaim-migrate @ 554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
400 gtk_widget_show(addbutton->parent); |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2281
diff
changeset
|
401 if (!(blist_options & OPT_BLIST_NO_BUTTONS)) { |
696
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
402 gtk_widget_hide(chatbutton->parent); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
403 gtk_widget_show(chatbutton->parent); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
404 } |
820 | 405 } |
1 | 406 |
3032 | 407 void set_blist_tab() |
408 { | |
409 GtkWidget *blist_notebook; | |
3154 | 410 if (!buddypane) |
411 return; | |
412 | |
3032 | 413 blist_notebook = buddypane->parent; /* The "Online" Page */ |
414 | |
415 debug_printf("blist_options = %d\n", blist_options); | |
416 if((blist_options & OPT_BLIST_BOTTOM_TAB)) | |
417 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(blist_notebook), GTK_POS_BOTTOM); | |
418 else | |
419 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(blist_notebook), GTK_POS_TOP); | |
420 | |
421 } | |
1 | 422 |
423 | |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
424 static int handle_click_group(GtkWidget *widget, GdkEventButton *event, struct group *g) |
1 | 425 { |
426 if (event->type == GDK_2BUTTON_PRESS) { | |
427 if (GTK_TREE_ITEM(widget)->expanded) | |
428 gtk_tree_item_collapse(GTK_TREE_ITEM(widget)); | |
429 else | |
430 gtk_tree_item_expand(GTK_TREE_ITEM(widget)); | |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
431 return TRUE; |
1 | 432 } |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
433 |
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
434 return FALSE; |
1 | 435 } |
436 | |
1739
0ddc5418a0b4
[gaim-migrate @ 1749]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
437 void pressed_im_bud(GtkWidget *widget, struct buddy *b) |
0ddc5418a0b4
[gaim-migrate @ 1749]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
438 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
439 struct gaim_conversation *c; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
440 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
441 c = gaim_find_conversation(b->name); |
1739
0ddc5418a0b4
[gaim-migrate @ 1749]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
442 |
0ddc5418a0b4
[gaim-migrate @ 1749]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
443 if (c != NULL) { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
444 gaim_window_show(gaim_conversation_get_window(c)); |
1739
0ddc5418a0b4
[gaim-migrate @ 1749]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
445 } else { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
446 c = gaim_conversation_new(GAIM_CONV_IM, b->name); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
447 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
448 gaim_conversation_set_user(c, b->user); |
1739
0ddc5418a0b4
[gaim-migrate @ 1749]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
449 } |
0ddc5418a0b4
[gaim-migrate @ 1749]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
450 } |
0ddc5418a0b4
[gaim-migrate @ 1749]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
451 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
452 void pressed_im(GtkWidget *widget, struct buddy_show *b) |
1 | 453 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
454 struct gaim_conversation *c; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
455 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
456 c = gaim_find_conversation(b->name); |
1 | 457 |
458 if (c != NULL) { | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
459 gaim_window_show(gaim_conversation_get_window(c)); |
1 | 460 } else { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
461 struct gaim_connection *gc; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
462 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
463 gc = (struct gaim_connection *)b->connlist->data; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
464 c = gaim_conversation_new(GAIM_CONV_IM, b->name); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
465 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
466 gaim_conversation_set_user(c, gc->user); |
1 | 467 } |
468 } | |
469 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
470 void pressed_log(GtkWidget *widget, char *name) |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1465
diff
changeset
|
471 { |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1465
diff
changeset
|
472 show_log(name); |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1465
diff
changeset
|
473 } |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1465
diff
changeset
|
474 |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
475 void show_syslog() |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
476 { |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
477 show_log(NULL); |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
478 } |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
479 |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
480 void pressed_alias_bs(GtkWidget *widget, struct buddy_show *bs) |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
481 { |
4349 | 482 struct gaim_connection *gc = bs->connlist->data; |
483 alias_dialog_bud(find_buddy(gc->user, bs->name)); | |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
484 } |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
485 |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
486 void pressed_alias_bud(GtkWidget *widget, struct buddy *b) |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
487 { |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
488 alias_dialog_bud(b); |
1 | 489 } |
490 | |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
491 static void menu_click(GtkObject *obj, char *who) |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
492 { |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
493 GList *list = gtk_object_get_user_data(obj); |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
494 struct proto_buddy_menu *pbm = list->data; |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
495 if (pbm->callback) |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
496 pbm->callback(pbm->gc, who); |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
497 } |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
498 |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
499 static int handle_click_buddy(GtkWidget *widget, GdkEventButton *event, struct buddy_show *b) |
1 | 500 { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
501 if (!b->connlist) |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
502 return FALSE; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
503 if (event->type == GDK_2BUTTON_PRESS && event->button == 1) { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
504 struct gaim_conversation *c; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
505 struct gaim_connection *gc; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
506 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
507 c = gaim_find_conversation(b->name); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
508 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
509 if (c != NULL) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
510 struct gaim_window *win = gaim_conversation_get_window(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
511 size_t index = gaim_conversation_get_index(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
512 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
513 gaim_window_switch_conversation(win, index); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
514 gaim_window_show(win); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
515 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
516 else |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
517 c = gaim_conversation_new(GAIM_CONV_IM, b->name); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
518 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
519 gc = (struct gaim_connection *)b->connlist->data; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
520 gaim_conversation_set_user(c, gc->user); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
521 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
522 gaim_window_switch_conversation(gaim_conversation_get_window(c), |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
523 gaim_conversation_get_index(c)); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
524 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
525 /* XXX-GTK gtk_widget_grab_focus(c->entry); */ |
1 | 526 } else if (event->type == GDK_BUTTON_PRESS && event->button == 3) { |
3251 | 527 static GtkWidget *menu = NULL; |
528 static GList *mo_top = NULL; | |
1032
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
529 GtkWidget *button; |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
530 GtkWidget *menuitem; |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
531 GtkWidget *conmenu; |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
532 GSList *cn = b->connlist; |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
533 struct gaim_connection *g; |
1 | 534 /* We're gonna make us a menu right here */ |
535 | |
3251 | 536 /* |
537 * If a menu already exists, destroy it before creating a new one, | |
538 * thus freeing-up the memory it occupied. Same for its associated | |
539 * (prpl menu items) GList. | |
540 */ | |
541 if(menu) { | |
542 gtk_widget_destroy(menu); | |
543 if(mo_top) { | |
544 g_list_foreach(mo_top, (GFunc)g_free, NULL); | |
545 g_list_free(mo_top); | |
546 mo_top = NULL; | |
547 } | |
548 } | |
549 | |
1 | 550 menu = gtk_menu_new(); |
551 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
552 button = gtk_menu_item_new_with_label(_("IM")); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
553 g_signal_connect(GTK_OBJECT(button), "activate", G_CALLBACK(pressed_im), b); |
1 | 554 gtk_menu_append(GTK_MENU(menu), button); |
555 gtk_widget_show(button); | |
556 | |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
557 button = gtk_menu_item_new_with_label(_("Alias")); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
558 g_signal_connect(GTK_OBJECT(button), "activate", G_CALLBACK(pressed_alias_bs), b); |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
559 gtk_menu_append(GTK_MENU(menu), button); |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
560 gtk_widget_show(button); |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
561 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
562 button = gtk_menu_item_new_with_label(_("Add Buddy Pounce")); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
563 g_signal_connect(GTK_OBJECT(button), "activate", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
564 G_CALLBACK(new_bp_callback), |
4414 | 565 cn ? find_buddy(((struct gaim_connection *)cn->data)->user, b->name) : NULL); |
1 | 566 gtk_menu_append(GTK_MENU(menu), button); |
567 gtk_widget_show(button); | |
568 | |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1465
diff
changeset
|
569 button = gtk_menu_item_new_with_label(_("View Log")); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
570 g_signal_connect(GTK_OBJECT(button), "activate", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
571 G_CALLBACK(pressed_log), b->name); |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1465
diff
changeset
|
572 gtk_menu_append(GTK_MENU(menu), button); |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1465
diff
changeset
|
573 gtk_widget_show(button); |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1465
diff
changeset
|
574 |
1032
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
575 if (g_slist_length(cn) > 1) { |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
576 while (cn) { |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
577 g = (struct gaim_connection *)cn->data; |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
578 if (g->prpl->buddy_menu) { |
3251 | 579 GList *mo = mo_top = g->prpl->buddy_menu(g, b->name); |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
580 |
1032
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
581 menuitem = gtk_menu_item_new_with_label(g->username); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
582 gtk_menu_append(GTK_MENU(menu), menuitem); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
583 gtk_widget_show(menuitem); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
584 |
1032
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
585 conmenu = gtk_menu_new(); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
586 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), conmenu); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
587 gtk_widget_show(conmenu); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
588 |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
589 while (mo) { |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
590 struct proto_buddy_menu *pbm = mo->data; |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
591 GtkWidget *button; |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
592 |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
593 button = gtk_menu_item_new_with_label(pbm->label); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
594 g_signal_connect(GTK_OBJECT(button), "activate", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
595 G_CALLBACK(menu_click), b->name); |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
596 gtk_object_set_user_data(GTK_OBJECT(button), mo); |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
597 gtk_menu_append(GTK_MENU(conmenu), button); |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
598 gtk_widget_show(button); |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
599 |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
600 mo = mo->next; |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
601 } |
1032
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
602 } |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
603 cn = g_slist_next(cn); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
604 } |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
605 } else { |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
606 g = (struct gaim_connection *)cn->data; |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
607 if (g->prpl->buddy_menu) { |
3251 | 608 GList *mo = mo_top = g->prpl->buddy_menu(g, b->name); |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
609 |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
610 while (mo) { |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
611 struct proto_buddy_menu *pbm = mo->data; |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
612 GtkWidget *button; |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
613 |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
614 button = gtk_menu_item_new_with_label(pbm->label); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
615 g_signal_connect(GTK_OBJECT(button), "activate", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
616 G_CALLBACK(menu_click), b->name); |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
617 gtk_object_set_user_data(GTK_OBJECT(button), mo); |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
618 gtk_menu_append(GTK_MENU(menu), button); |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
619 gtk_widget_show(button); |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
620 |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
621 mo = mo->next; |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
622 } |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
623 } |
1032
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
624 } |
1874
1e33bd2d7780
[gaim-migrate @ 1884]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1870
diff
changeset
|
625 |
1e33bd2d7780
[gaim-migrate @ 1884]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1870
diff
changeset
|
626 /* we send the menu widget so we can add menuitems within a plugin */ |
3517 | 627 plugin_event(event_draw_menu, menu, b->name); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
628 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
629 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, event->button, event->time); |
1 | 630 |
631 } else if (event->type == GDK_3BUTTON_PRESS && event->button == 2) { | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
632 if (!g_strcasecmp("zilding", normalize (b->name))) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
633 show_ee_dialog(0); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
634 else if (!g_strcasecmp("robflynn", normalize (b->name))) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
635 show_ee_dialog(1); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
636 else if (!g_strcasecmp("flynorange", normalize (b->name))) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
637 show_ee_dialog(2); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
638 else if (!g_strcasecmp("ewarmenhoven", normalize (b->name))) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
639 show_ee_dialog(3); |
2472 | 640 else if (!g_strcasecmp("markster97", normalize (b->name))) |
641 show_ee_dialog(4); | |
2993 | 642 else if (!g_strcasecmp("seanegn", normalize (b->name))) |
643 show_ee_dialog(5); | |
3043 | 644 else if (!g_strcasecmp("chipx86", normalize (b->name))) |
645 show_ee_dialog(6); | |
3152 | 646 else if (!g_strcasecmp("kingant", normalize (b->name))) |
647 show_ee_dialog(7); | |
3508 | 648 else if (!g_strcasecmp("lschiere", normalize (b->name))) |
649 show_ee_dialog(8); | |
1 | 650 |
651 } else { | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
652 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
653 /* Anything for other buttons? :) */ |
1 | 654 } |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
655 |
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
656 return FALSE; |
1 | 657 } |
658 | |
1396
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
659 static void un_alias(GtkWidget *a, struct buddy *b) |
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
660 { |
4227 | 661 b->alias[0] = '\0'; |
662 handle_buddy_rename(b, b->name); /* make me a sammich! */ | |
3136 | 663 serv_alias_buddy(b); |
4349 | 664 gaim_blist_save(); |
1396
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
665 } |
1 | 666 |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
667 static gboolean click_edit_tree(GtkWidget *widget, GdkEventButton *event, gpointer data) |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
668 { |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
669 GtkCTreeNode *node; |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
670 int *type; |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
671 int row, column; |
3251 | 672 static GtkWidget *menu = NULL; |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
673 GtkWidget *button; |
3313 | 674 static GList *mo_top = NULL; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
675 |
1392
dc6ba774bfc5
[gaim-migrate @ 1402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1391
diff
changeset
|
676 if (event->button != 3 || event->type != GDK_BUTTON_PRESS) |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
677 return FALSE; |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
678 |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
679 if (!gtk_clist_get_selection_info(GTK_CLIST(edittree), event->x, event->y, &row, &column)) |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
680 return FALSE; |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
681 |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
682 node = gtk_ctree_node_nth(GTK_CTREE(edittree), row); |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
683 type = gtk_ctree_node_get_row_data(GTK_CTREE(edittree), node); |
3251 | 684 |
685 /* | |
686 * If a menu already exists, destroy it before creating a new one, | |
687 * thus freeing-up the memory it occupied. | |
688 */ | |
689 if(menu) { | |
690 gtk_widget_destroy(menu); | |
691 menu = NULL; /* safety measure */ | |
3313 | 692 if(mo_top) { |
693 g_list_foreach(mo_top, (GFunc)g_free, NULL); | |
694 g_list_free(mo_top); | |
695 mo_top = NULL; | |
696 } | |
3251 | 697 } |
698 | |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
699 if (*type == EDIT_GROUP) { |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
700 struct group *group = (struct group *)type; |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
701 menu = gtk_menu_new(); |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
702 |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
703 button = gtk_menu_item_new_with_label(_("Rename")); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
704 g_signal_connect(GTK_OBJECT(button), "activate", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
705 G_CALLBACK(show_rename_group), group); |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
706 gtk_menu_append(GTK_MENU(menu), button); |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
707 gtk_widget_show(button); |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
708 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
709 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, event->button, event->time); |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
710 |
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
711 return TRUE; |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
712 } else if (*type == EDIT_BUDDY) { |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
713 struct buddy *b = (struct buddy *)type; |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
714 menu = gtk_menu_new(); |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
715 |
1739
0ddc5418a0b4
[gaim-migrate @ 1749]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
716 button = gtk_menu_item_new_with_label(_("IM")); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
717 g_signal_connect(GTK_OBJECT(button), "activate", G_CALLBACK(pressed_im_bud), b); |
1739
0ddc5418a0b4
[gaim-migrate @ 1749]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
718 gtk_menu_append(GTK_MENU(menu), button); |
0ddc5418a0b4
[gaim-migrate @ 1749]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
719 gtk_widget_show(button); |
0ddc5418a0b4
[gaim-migrate @ 1749]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
720 |
1392
dc6ba774bfc5
[gaim-migrate @ 1402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1391
diff
changeset
|
721 button = gtk_menu_item_new_with_label(_("Alias")); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
722 g_signal_connect(GTK_OBJECT(button), "activate", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
723 G_CALLBACK(pressed_alias_bud), b); |
1392
dc6ba774bfc5
[gaim-migrate @ 1402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1391
diff
changeset
|
724 gtk_menu_append(GTK_MENU(menu), button); |
dc6ba774bfc5
[gaim-migrate @ 1402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1391
diff
changeset
|
725 gtk_widget_show(button); |
dc6ba774bfc5
[gaim-migrate @ 1402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1391
diff
changeset
|
726 |
4227 | 727 if (b->alias[0]) { |
1396
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
728 button = gtk_menu_item_new_with_label(_("Un-Alias")); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
729 g_signal_connect(GTK_OBJECT(button), "activate", G_CALLBACK(un_alias), b); |
1396
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
730 gtk_menu_append(GTK_MENU(menu), button); |
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
731 gtk_widget_show(button); |
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
732 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
733 |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
734 button = gtk_menu_item_new_with_label(_("Rename")); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
735 g_signal_connect(GTK_OBJECT(button), "activate", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
736 G_CALLBACK(show_rename_buddy), b); |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
737 gtk_menu_append(GTK_MENU(menu), button); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
738 gtk_widget_show(button); |
1396
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
739 |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
740 button = gtk_menu_item_new_with_label(_("Add Buddy Pounce")); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
741 g_signal_connect(GTK_OBJECT(button), "activate", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
742 G_CALLBACK(new_bp_callback), b); |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
743 gtk_menu_append(GTK_MENU(menu), button); |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
744 gtk_widget_show(button); |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
745 |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1465
diff
changeset
|
746 button = gtk_menu_item_new_with_label(_("View Log")); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
747 g_signal_connect(GTK_OBJECT(button), "activate", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
748 G_CALLBACK(pressed_log), b->name); |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1465
diff
changeset
|
749 gtk_menu_append(GTK_MENU(menu), button); |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1465
diff
changeset
|
750 gtk_widget_show(button); |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1465
diff
changeset
|
751 |
3313 | 752 /* |
753 * Add protocol-specific edit buddy menu items if they exist | |
754 */ | |
4349 | 755 if (b->user->gc && b->user->gc->prpl->edit_buddy_menu) { |
756 GList *mo = mo_top = b->user->gc->prpl->edit_buddy_menu(b->user->gc, b->name); | |
3313 | 757 |
758 while (mo) { | |
759 struct proto_buddy_menu *pbm = mo->data; | |
760 GtkWidget *button; | |
761 | |
762 button = gtk_menu_item_new_with_label(pbm->label); | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
763 g_signal_connect(GTK_OBJECT(button), "activate", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
764 G_CALLBACK(menu_click), b->name); |
3313 | 765 gtk_object_set_user_data(GTK_OBJECT(button), mo); |
766 gtk_menu_append(GTK_MENU(menu), button); | |
767 gtk_widget_show(button); | |
768 | |
769 mo = mo->next; | |
770 } | |
771 } | |
772 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
773 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, event->button, event->time); |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
774 |
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
775 return TRUE; |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
776 } |
1456
6650776468b3
[gaim-migrate @ 1466]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
777 |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
778 return FALSE; |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
779 } |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
780 |
1 | 781 |
3059 | 782 /* |
783 * Find and remove CTree node associated with buddylist entry | |
784 */ | |
785 static void ui_remove_buddy_node(struct group *rem_g, struct buddy *rem_b) | |
786 { | |
787 GtkCTreeNode *gnode = NULL, *bnode; | |
788 | |
789 if((gnode = gtk_ctree_find_by_row_data(GTK_CTREE(edittree), NULL, rem_g)) != NULL && | |
790 (bnode = gtk_ctree_find_by_row_data(GTK_CTREE(edittree), gnode, rem_b)) != NULL) | |
791 { | |
792 gtk_ctree_remove_node(GTK_CTREE(edittree), bnode); | |
793 } | |
794 } | |
795 | |
4349 | 796 void ui_remove_buddy(struct buddy *rem_b) |
1 | 797 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
798 struct gaim_conversation *c; |
4349 | 799 struct group *rem_g = find_group_by_buddy(rem_b); |
1069
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
800 struct group_show *gs; |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
801 struct buddy_show *bs; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
802 |
1069
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
803 gs = find_group_show(rem_g->name); |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
804 if (gs) { |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
805 bs = find_buddy_show(gs, rem_b->name); |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
806 if (bs) { |
4349 | 807 if (g_slist_find(bs->connlist, rem_b->user->gc)) { |
808 bs->connlist = g_slist_remove(bs->connlist, rem_b->user->gc); | |
1069
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
809 if (!g_slist_length(bs->connlist)) { |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
810 gs->members = g_slist_remove(gs->members, bs); |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
811 if (bs->log_timer > 0) |
4168 | 812 g_source_remove(bs->log_timer); |
1098
b335c0ce305e
[gaim-migrate @ 1108]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1097
diff
changeset
|
813 bs->log_timer = 0; |
1108
cb338aa38e78
[gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
814 remove_buddy_show(gs, bs); |
1069
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
815 g_free(bs->name); |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
816 g_free(bs); |
4396 | 817 if (!g_slist_length(gs->members) && |
818 (blist_options & OPT_BLIST_NO_MT_GRP)) { | |
1069
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
819 shows = g_slist_remove(shows, gs); |
1108
cb338aa38e78
[gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
820 gtk_tree_remove_item(GTK_TREE(buddies), gs->item); |
1069
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
821 g_free(gs->name); |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
822 g_free(gs); |
3134 | 823 gs = NULL; |
2778
27c22147e023
[gaim-migrate @ 2791]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2736
diff
changeset
|
824 } |
27c22147e023
[gaim-migrate @ 2791]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2736
diff
changeset
|
825 } |
27c22147e023
[gaim-migrate @ 2791]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2736
diff
changeset
|
826 } |
27c22147e023
[gaim-migrate @ 2791]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2736
diff
changeset
|
827 } |
3103 | 828 if (gs) |
829 update_num_group(gs); | |
1069
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
830 } |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
831 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
832 c = gaim_find_conversation(rem_b->name); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
833 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
834 if (c) |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
835 gaim_conversation_update(c, GAIM_CONV_UPDATE_REMOVE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
836 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
837 /* CONVXXX update_buttons_by_protocol(c); */ |
3059 | 838 |
839 /* Remove CTree node for buddy */ | |
840 ui_remove_buddy_node(rem_g, rem_b); | |
841 | |
1 | 842 } |
843 | |
4349 | 844 void ui_remove_group(struct group *rem_g) |
1 | 845 { |
1297
aa6a0fe8e03f
[gaim-migrate @ 1307]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
846 struct group_show *gs; |
4349 | 847 GtkCTreeNode *gnode = gtk_ctree_find_by_row_data(GTK_CTREE(edittree), NULL, rem_g); |
848 gtk_ctree_remove_node(GTK_CTREE(edittree), gnode); | |
849 | |
2382
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2380
diff
changeset
|
850 |
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2380
diff
changeset
|
851 if ((gs = find_group_show(rem_g->name)) != NULL) { |
1465
163b9ee8d789
[gaim-migrate @ 1475]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
852 shows = g_slist_remove(shows, gs); |
1297
aa6a0fe8e03f
[gaim-migrate @ 1307]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
853 gtk_tree_remove_item(GTK_TREE(buddies), gs->item); |
aa6a0fe8e03f
[gaim-migrate @ 1307]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
854 g_free(gs->name); |
aa6a0fe8e03f
[gaim-migrate @ 1307]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
855 g_free(gs); |
aa6a0fe8e03f
[gaim-migrate @ 1307]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
856 } |
1 | 857 } |
858 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
859 gboolean edit_drag_compare_func(GtkCTree *ctree, GtkCTreeNode *source_node, |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
860 GtkCTreeNode *new_parent, GtkCTreeNode *new_sibling) |
1 | 861 { |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
862 int *type; |
1 | 863 |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
864 type = (int *)gtk_ctree_node_get_row_data(GTK_CTREE(ctree), source_node); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
865 |
4349 | 866 if (*type == EDIT_GROUP) { |
1 | 867 if (!new_parent) |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
868 return TRUE; |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
869 } else if (*type == EDIT_BUDDY) { |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
870 if (new_parent) { |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
871 type = (int *)gtk_ctree_node_get_row_data(GTK_CTREE(ctree), new_parent); |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
872 if (*type == EDIT_GROUP) |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
873 return TRUE; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
874 } |
1 | 875 } |
876 | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
877 return FALSE; |
1 | 878 } |
879 | |
880 | |
2380
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
881 /* you really shouldn't call this function */ |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
882 void redo_buddy_list() |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
883 { |
1069
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
884 /* so here we can safely assume that we don't have to add or delete anything, we |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
885 * just have to go through and reorder everything. remember, nothing is going to |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
886 * change connections, so we can assume that we don't have to change any user |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
887 * data or anything. this is just a simple reordering. so calm down. */ |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
888 /* note: we only have to do this if we want to strongly enforce order; however, |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
889 * order doesn't particularly matter to the stability of the program. but, it's |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
890 * kind of nice to have */ |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
891 /* the easy way to implement this is just to go through shows and destroy all the |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
892 * group_shows, then go through the connections and put everything back. though, |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
893 * there are slight complications with that; most of them deal with timeouts and |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
894 * people not seeing the login icon for the full 10 seconds. butt fuck them. */ |
1069
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
895 GSList *s = shows; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
896 struct group_show *gs; |
1069
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
897 GSList *m; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
898 struct buddy_show *bs; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
899 GSList *gr; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
900 struct group *g; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
901 struct buddy *b; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
902 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
903 if (!blist) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
904 return; |
1150
aa3dda7fc352
[gaim-migrate @ 1160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1138
diff
changeset
|
905 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
906 while (s) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
907 gs = (struct group_show *)s->data; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
908 s = g_slist_remove(s, gs); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
909 m = gs->members; |
1108
cb338aa38e78
[gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
910 gtk_tree_remove_item(GTK_TREE(buddies), gs->item); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
911 while (m) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
912 bs = (struct buddy_show *)m->data; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
913 m = g_slist_remove(m, bs); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
914 if (bs->log_timer > 0) |
4168 | 915 g_source_remove(bs->log_timer); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
916 g_free(bs->name); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
917 g_free(bs); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
918 } |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
919 g_free(gs->name); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
920 g_free(gs); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
921 } |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
922 shows = NULL; |
4349 | 923 gr = groups; |
924 while (gr) { | |
925 g = (struct group *)gr->data; | |
926 gr = gr->next; | |
927 gs = find_group_show(g->name); | |
928 if (!gs && !(blist_options & OPT_BLIST_NO_MT_GRP) | |
929 && gaim_group_on_account(g, NULL)) | |
930 gs = new_group_show(g->name); | |
931 m = g->members; | |
932 while (m) { | |
933 b = (struct buddy *)m->data; | |
934 m = m->next; | |
935 if (b->present) { | |
936 if (!gs) | |
937 gs = new_group_show(g->name); | |
938 bs = find_buddy_show(gs, b->name); | |
939 if (!bs) { | |
940 if (b->user->gc->prpl->list_icon) | |
941 bs = new_buddy_show(gs, b, | |
942 b->user->gc->prpl->list_icon(b-> | |
943 uc)); | |
944 else | |
945 bs = new_buddy_show(gs, b, (char **)no_icon_xpm); | |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
946 } |
4349 | 947 bs->connlist = g_slist_append(bs->connlist, b->user->gc); |
948 update_num_group(gs); | |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
949 } |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
950 } |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
951 } |
2605
ff9d9b4f7aa2
[gaim-migrate @ 2618]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2598
diff
changeset
|
952 update_idle_times(); |
1069
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
953 } |
1 | 954 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
955 void |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
956 reset_convo_gcs() |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
957 { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
958 GList *l; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
959 struct gaim_conversation *c; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
960 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
961 for (l = gaim_get_ims(); l != NULL; l = l->next) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
962 c = (struct gaim_conversation *)l->data; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
963 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
964 if (!g_slist_find(connections, gaim_conversation_get_gc(c))) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
965 struct aim_user *user; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
966 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
967 if (connections == NULL) |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
968 user = ((struct gaim_connection *)connections->data)->user; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
969 else |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
970 user = NULL; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
971 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
972 gaim_conversation_set_user(c, user); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
973 } |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
974 } |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
975 } |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
976 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
977 static void edit_tree_move(GtkCTree *ctree, GtkCTreeNode *child, |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
978 GtkCTreeNode *parent, GtkCTreeNode *sibling, |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
979 gpointer data) |
1 | 980 { |
1456
6650776468b3
[gaim-migrate @ 1466]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
981 int *ctype, *ptype = NULL, *stype = NULL; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
982 |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
983 ctype = (int *)gtk_ctree_node_get_row_data(GTK_CTREE(ctree), child); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
984 |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
985 if (parent) |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
986 ptype = (int *)gtk_ctree_node_get_row_data(GTK_CTREE(ctree), parent); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
987 |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
988 if (sibling) |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
989 stype = (int *)gtk_ctree_node_get_row_data(GTK_CTREE(ctree), sibling); |
1 | 990 |
4349 | 991 if (*ctype == EDIT_BUDDY) { |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
992 /* we moved a buddy. hopefully we just changed groups or positions or something. |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
993 * if we changed connections, we copy the buddy to the new connection. if the new |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
994 * connection already had the buddy in its buddy list but in a different group, |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
995 * we change the group that the buddy is in */ |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
996 struct group *old_g, *new_g = (struct group *)ptype; |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
997 struct buddy *s = NULL, *buddy = (struct buddy *)ctype; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
998 int pos; |
1 | 999 |
4349 | 1000 old_g = find_group_by_buddy(buddy); |
1001 | |
1002 old_g->members = g_slist_remove(old_g->members, buddy); | |
1 | 1003 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1004 if (sibling) { |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1005 s = (struct buddy *)stype; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1006 pos = g_slist_index(new_g->members, s); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1007 if (pos) |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1008 new_g->members = g_slist_insert(new_g->members, buddy, pos); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1009 else |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1010 new_g->members = g_slist_prepend(new_g->members, buddy); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1011 } else |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1012 new_g->members = g_slist_append(new_g->members, buddy); |
1 | 1013 |
4349 | 1014 serv_move_buddy(buddy, old_g, new_g); |
1015 | |
1016 gaim_blist_save(); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1017 } else { /* group */ |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1018 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1019 /* move the group. if moving connections, copy the group, and each buddy in the |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1020 * group. if the buddy exists in the new connection, leave it where it is. */ |
1 | 1021 |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1022 struct group *g, *g2, *group; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1023 int pos; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1024 |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1025 group = (struct group *)ctype; |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1026 |
4349 | 1027 g = group; |
1028 | |
1029 groups = g_slist_remove(groups, g); | |
1030 | |
1031 if (sibling) { | |
1032 g2 = (struct group *)stype; | |
1033 pos = g_slist_index(groups, g2); | |
1034 if (pos) | |
1035 groups = g_slist_insert(groups, g, pos); | |
1036 else | |
1037 groups = g_slist_prepend(groups, g); | |
1038 } else | |
1039 groups = g_slist_append(groups, g); | |
1040 | |
1041 gaim_blist_save(); | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1042 } |
1 | 1043 |
1069
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
1044 redo_buddy_list(); |
1070
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
1045 update_num_groups(); |
1 | 1046 } |
1047 | |
3111 | 1048 void |
1049 create_prpl_icon(GtkWidget *widget, struct gaim_connection *gc, | |
1050 GdkPixmap **pixmap, GdkBitmap **mask) | |
1051 { | |
1052 /* This whole thing is a hack--but it looks nice. | |
1053 * Probably should have a prpl->icon(struct gaim_connection *) to | |
1054 * do this. */ | |
1055 GtkStyle *style; | |
1056 char **xpm = NULL; | |
1057 | |
1058 if (widget == NULL || gc == NULL || pixmap == NULL || mask == NULL) | |
1059 return; | |
1060 | |
1061 style = gtk_widget_get_style( widget ); | |
1062 | |
3159 | 1063 if (gc->prpl->list_icon) { |
3111 | 1064 if (gc->prpl->protocol == PROTO_OSCAR) { |
1065 if (isdigit(*gc->username)) { | |
1066 xpm = gc->prpl->list_icon(0); | |
1067 } else { | |
1068 xpm = gc->prpl->list_icon(0x10); | |
1069 } | |
1070 } else { | |
1071 xpm = gc->prpl->list_icon (0); | |
1072 } | |
3159 | 1073 } |
3111 | 1074 if (xpm == NULL) |
1075 xpm = (char **)no_icon_xpm; | |
1076 | |
1077 *pixmap = gdk_pixmap_create_from_xpm_d(widget->window, mask, &style->bg[GTK_STATE_NORMAL], xpm); | |
1078 } | |
1 | 1079 |
1080 void build_edit_tree() | |
1081 { | |
4349 | 1082 GtkCTreeNode *p = NULL, *n; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1083 GSList *grp; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1084 GSList *mem; |
1 | 1085 struct group *g; |
1086 struct buddy *b; | |
1087 char *text[1]; | |
1088 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1089 if (!blist) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1090 return; |
1032
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
1091 |
1 | 1092 gtk_clist_freeze(GTK_CLIST(edittree)); |
1093 gtk_clist_clear(GTK_CLIST(edittree)); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1094 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1095 |
4349 | 1096 grp = groups; |
1097 | |
1098 while (grp) { | |
1099 | |
1100 g = (struct group *)grp->data; | |
1101 | |
1102 text[0] = g->name; | |
1103 | |
1104 p = gtk_ctree_insert_node(GTK_CTREE(edittree), NULL, | |
1105 NULL, text, 5, NULL, NULL, NULL, NULL, 0, 1); | |
1106 | |
1107 gtk_ctree_node_set_row_data(GTK_CTREE(edittree), p, g); | |
1108 | |
1109 n = NULL; | |
1110 | |
1111 mem = g->members; | |
1112 | |
1113 while (mem) { | |
1114 char buf[256]; | |
1115 b = (struct buddy *)mem->data; | |
1116 if(b->user->gc) { | |
4227 | 1117 if (get_buddy_alias_only(b)) { |
1118 g_snprintf(buf, sizeof(buf), "%s (%s)", b->name, get_buddy_alias(b)); | |
1396
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
1119 text[0] = buf; |
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
1120 } else |
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
1121 text[0] = b->name; |
1 | 1122 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1123 n = gtk_ctree_insert_node(GTK_CTREE(edittree), |
4349 | 1124 p, NULL, text, 5, |
1125 NULL, NULL, NULL, NULL, 1, 1); | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1126 |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1127 gtk_ctree_node_set_row_data(GTK_CTREE(edittree), n, b); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1128 } |
4349 | 1129 |
1130 mem = mem->next; | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1131 } |
4349 | 1132 grp = g_slist_next(grp); |
1 | 1133 } |
1134 | |
1135 gtk_clist_thaw(GTK_CLIST(edittree)); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1136 |
1 | 1137 } |
1138 | |
2382
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2380
diff
changeset
|
1139 void ui_add_buddy(struct gaim_connection *gc, struct group *g, struct buddy *b) |
1 | 1140 { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1141 GtkCTreeNode *p = NULL, *n; |
1699
644056e095f1
[gaim-migrate @ 1709]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1694
diff
changeset
|
1142 char *text[1]; |
644056e095f1
[gaim-migrate @ 1709]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1694
diff
changeset
|
1143 char buf[256]; |
2382
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2380
diff
changeset
|
1144 struct group_show *gs = find_group_show(g->name); |
1 | 1145 |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1146 b->edittype = EDIT_BUDDY; |
1088
18a14e6dd0af
[gaim-migrate @ 1098]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1085
diff
changeset
|
1147 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1148 if (gs) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1149 update_num_group(gs); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1150 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1151 if (!blist) |
2382
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2380
diff
changeset
|
1152 return; |
1699
644056e095f1
[gaim-migrate @ 1709]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1694
diff
changeset
|
1153 |
4349 | 1154 if(!b->user->gc) |
1155 return; | |
1156 | |
1699
644056e095f1
[gaim-migrate @ 1709]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1694
diff
changeset
|
1157 p = gtk_ctree_find_by_row_data(GTK_CTREE(edittree), NULL, g); |
4227 | 1158 if (get_buddy_alias_only(b)) { |
1159 g_snprintf(buf, sizeof(buf), "%s (%s)", b->name, get_buddy_alias(b)); | |
1699
644056e095f1
[gaim-migrate @ 1709]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1694
diff
changeset
|
1160 text[0] = buf; |
644056e095f1
[gaim-migrate @ 1709]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1694
diff
changeset
|
1161 } else |
644056e095f1
[gaim-migrate @ 1709]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1694
diff
changeset
|
1162 text[0] = b->name; |
644056e095f1
[gaim-migrate @ 1709]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1694
diff
changeset
|
1163 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1164 n = gtk_ctree_insert_node(GTK_CTREE(edittree), p, NULL, text, 5, NULL, NULL, NULL, NULL, 1, 1); |
1699
644056e095f1
[gaim-migrate @ 1709]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1694
diff
changeset
|
1165 gtk_ctree_node_set_row_data(GTK_CTREE(edittree), n, b); |
1 | 1166 } |
1167 | |
4349 | 1168 void ui_add_group(struct group *g) |
1 | 1169 { |
4349 | 1170 GtkCTreeNode *p; |
1663
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1662
diff
changeset
|
1171 char *text[1]; |
1 | 1172 |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1173 g->edittype = EDIT_GROUP; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1174 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1175 if (!blist) |
2382
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2380
diff
changeset
|
1176 return; |
1088
18a14e6dd0af
[gaim-migrate @ 1098]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1085
diff
changeset
|
1177 |
1663
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1662
diff
changeset
|
1178 text[0] = g->name; |
4349 | 1179 p = gtk_ctree_insert_node(GTK_CTREE(edittree), NULL, NULL, text, 5, NULL, NULL, NULL, NULL, 0, 1); |
1663
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1662
diff
changeset
|
1180 gtk_ctree_node_set_row_data(GTK_CTREE(edittree), p, g); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1181 |
4349 | 1182 if (!(blist_options & OPT_BLIST_NO_MT_GRP) && !find_group_show(g->name) |
1183 && gaim_group_on_account(g, NULL)) | |
2382
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2380
diff
changeset
|
1184 new_group_show(g->name); |
1 | 1185 } |
1186 | |
1187 | |
1188 static void do_del_buddy(GtkWidget *w, GtkCTree *ctree) | |
1189 { | |
1190 GtkCTreeNode *node; | |
1191 struct buddy *b; | |
1192 struct group *g; | |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1193 int *type; |
1 | 1194 GList *i; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1195 |
1 | 1196 i = GTK_CLIST(edittree)->selection; |
1197 if (i) { | |
1198 node = i->data; | |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1199 type = (int *)gtk_ctree_node_get_row_data(GTK_CTREE(edittree), node); |
1 | 1200 |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1201 if (*type == EDIT_BUDDY) { |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1202 b = (struct buddy *)type; |
4349 | 1203 g = find_group_by_buddy(b); |
1204 serv_remove_buddy(b->user->gc, b->name, g->name); | |
1205 remove_buddy(b); | |
1206 gaim_blist_save(); | |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1207 } else if (*type == EDIT_GROUP) { |
4349 | 1208 remove_group((struct group *)type); |
1209 gaim_blist_save(); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1210 } |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1211 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1212 } else { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1213 /* Nothing selected. */ |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1214 } |
1 | 1215 } |
1216 | |
1217 | |
1218 void import_callback(GtkWidget *widget, void *null) | |
1219 { | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1220 show_import_dialog(); |
1 | 1221 } |
1222 | |
1223 void add_buddy_callback(GtkWidget *widget, void *dummy) | |
1224 { | |
1225 char *grp = NULL; | |
1226 GtkCTreeNode *node; | |
1227 GList *i; | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1228 struct gaim_connection *gc = NULL; |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1229 int *type; |
1 | 1230 |
1231 i = GTK_CLIST(edittree)->selection; | |
1232 if (i) { | |
1233 node = i->data; | |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1234 type = (int *)gtk_ctree_node_get_row_data(GTK_CTREE(edittree), node); |
1 | 1235 |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1236 if (*type == EDIT_BUDDY) { |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1237 struct buddy *b = (struct buddy *)type; |
4349 | 1238 struct group *g = find_group_by_buddy(b); |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1239 grp = g->name; |
4349 | 1240 gc = b->user->gc; |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1241 } else if (*type == EDIT_GROUP) { |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1242 struct group *g = (struct group *)type; |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1243 grp = g->name; |
4349 | 1244 if(g->members) |
1245 gc = ((struct buddy *)g->members->data)->user->gc; | |
1246 else | |
1247 gc = connections->data; | |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1248 } else { |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1249 gc = (struct gaim_connection *)type; |
1 | 1250 } |
1251 } | |
2582
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2569
diff
changeset
|
1252 show_add_buddy(gc, NULL, grp, NULL); |
1 | 1253 |
1254 } | |
1255 | |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
1256 void add_group_callback(GtkWidget *widget, void *dummy) |
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
1257 { |
1072
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
1258 GtkCTreeNode *node; |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
1259 GList *i; |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
1260 struct gaim_connection *gc = NULL; |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1261 int *type; |
1072
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
1262 |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
1263 i = GTK_CLIST(edittree)->selection; |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
1264 if (i) { |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
1265 node = i->data; |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1266 type = (int *)gtk_ctree_node_get_row_data(GTK_CTREE(edittree), node); |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1267 if (*type == EDIT_BUDDY) |
4349 | 1268 gc = ((struct buddy *)type)->user->gc; |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1269 else if (*type == EDIT_GROUP) |
4349 | 1270 gc = connections->data; |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1271 else |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1272 gc = (struct gaim_connection *)type; |
1072
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
1273 } |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
1274 show_add_group(gc); |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
1275 } |
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
1276 |
935
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1277 static void im_callback(GtkWidget *widget, GtkTree *tree) |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1278 { |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1279 GList *i; |
1032
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
1280 struct buddy_show *b = NULL; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1281 struct gaim_conversation *c; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1282 struct aim_user *user; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1283 |
3466 | 1284 i = GTK_TREE_SELECTION_OLD(tree); |
935
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1285 if (i) { |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1286 b = gtk_object_get_user_data(GTK_OBJECT(i->data)); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1287 } |
1095
ca8206682e3f
[gaim-migrate @ 1105]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1092
diff
changeset
|
1288 if (!i || !b) { |
935
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1289 show_im_dialog(); |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1290 return; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1291 } |
935
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1292 if (!b->name) |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1293 return; |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1294 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1295 c = gaim_find_conversation(b->name); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1296 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1297 if (c == NULL) |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1298 c = gaim_conversation_new(GAIM_CONV_IM, b->name); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1299 else |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1300 gaim_window_raise(gaim_conversation_get_window(c)); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1301 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1302 user = ((struct gaim_connection *)b->connlist->data)->user; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1303 gaim_conversation_set_user(c, user); |
935
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1304 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1305 |
1 | 1306 static void info_callback(GtkWidget *widget, GtkTree *tree) |
1307 { | |
1308 GList *i; | |
1032
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
1309 struct buddy_show *b = NULL; |
3466 | 1310 i = GTK_TREE_SELECTION_OLD(tree); |
1 | 1311 if (i) { |
1312 b = gtk_object_get_user_data(GTK_OBJECT(i->data)); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1313 } |
1095
ca8206682e3f
[gaim-migrate @ 1105]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1092
diff
changeset
|
1314 if (!i || !b) { |
935
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1315 show_info_dialog(); |
1 | 1316 return; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1317 } |
1 | 1318 if (!b->name) |
1319 return; | |
1693
6ccd49e6f24c
[gaim-migrate @ 1703]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1681
diff
changeset
|
1320 if (b->connlist) |
6ccd49e6f24c
[gaim-migrate @ 1703]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1681
diff
changeset
|
1321 serv_get_info(b->connlist->data, b->name); |
1 | 1322 } |
1323 | |
1324 | |
1325 void chat_callback(GtkWidget *widget, GtkTree *tree) | |
1326 { | |
1327 join_chat(); | |
1328 } | |
1329 | |
1929
d51ea669d84e
[gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1918
diff
changeset
|
1330 static void away_callback(GtkWidget *widget, GtkTree *tree) |
d51ea669d84e
[gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1918
diff
changeset
|
1331 { |
d51ea669d84e
[gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1918
diff
changeset
|
1332 GSList *awy = away_messages; |
3251 | 1333 static GtkWidget *menu = NULL; |
1929
d51ea669d84e
[gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1918
diff
changeset
|
1334 GtkWidget *menuitem; |
d51ea669d84e
[gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1918
diff
changeset
|
1335 |
d51ea669d84e
[gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1918
diff
changeset
|
1336 if (!awy) |
d51ea669d84e
[gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1918
diff
changeset
|
1337 return; |
d51ea669d84e
[gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1918
diff
changeset
|
1338 |
3251 | 1339 /* |
1340 * If a menu already exists, destroy it before creating a new one, | |
1341 * thus freeing-up the memory it occupied. | |
1342 */ | |
1343 if(menu) | |
1344 gtk_widget_destroy(menu); | |
1345 | |
1929
d51ea669d84e
[gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1918
diff
changeset
|
1346 menu = gtk_menu_new(); |
d51ea669d84e
[gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1918
diff
changeset
|
1347 |
d51ea669d84e
[gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1918
diff
changeset
|
1348 while (awy) { |
d51ea669d84e
[gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1918
diff
changeset
|
1349 struct away_message *a = awy->data; |
d51ea669d84e
[gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1918
diff
changeset
|
1350 |
d51ea669d84e
[gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1918
diff
changeset
|
1351 menuitem = gtk_menu_item_new_with_label(a->name); |
d51ea669d84e
[gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1918
diff
changeset
|
1352 gtk_menu_append(GTK_MENU(menu), menuitem); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
1353 g_signal_connect(GTK_OBJECT(menuitem), "activate", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
1354 G_CALLBACK(do_away_message), a); |
1929
d51ea669d84e
[gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1918
diff
changeset
|
1355 gtk_widget_show(menuitem); |
d51ea669d84e
[gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1918
diff
changeset
|
1356 awy = awy->next; |
d51ea669d84e
[gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1918
diff
changeset
|
1357 } |
d51ea669d84e
[gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1918
diff
changeset
|
1358 |
3271 | 1359 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 1, GDK_CURRENT_TIME ); |
1929
d51ea669d84e
[gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1918
diff
changeset
|
1360 } |
d51ea669d84e
[gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1918
diff
changeset
|
1361 |
1 | 1362 void rem_bp(GtkWidget *w, struct buddy_pounce *b) |
1363 { | |
1364 buddy_pounces = g_list_remove(buddy_pounces, b); | |
689
4e3f5d9cacd5
[gaim-migrate @ 699]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
1365 do_bp_menu(); |
4e3f5d9cacd5
[gaim-migrate @ 699]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
1366 save_prefs(); |
1 | 1367 } |
1368 | |
2131
acc11216ec5d
[gaim-migrate @ 2141]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2125
diff
changeset
|
1369 void do_pounce(struct gaim_connection *gc, char *name, int when) |
1 | 1370 { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1371 char *who; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1372 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1373 struct buddy_pounce *b; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1374 struct gaim_conversation *c; |
1155 | 1375 struct aim_user *u; |
1 | 1376 |
1377 GList *bp = buddy_pounces; | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1378 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1379 who = g_strdup(normalize (name)); |
1 | 1380 |
1857
9ea0b9531bc9
[gaim-migrate @ 1867]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1825
diff
changeset
|
1381 while (bp) { |
1155 | 1382 b = (struct buddy_pounce *)bp->data; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1383 bp = bp->next; /* increment the list here because rem_bp can make our handle bad */ |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1384 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1385 if (!(b->options & when)) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1386 continue; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1387 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1388 u = find_user(b->pouncer, b->protocol); /* find our user */ |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1389 if (u == NULL) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1390 continue; |
1155 | 1391 |
1230
5395053cdee1
[gaim-migrate @ 1240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1229
diff
changeset
|
1392 /* check and see if we're signed on as the pouncer */ |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1393 if (u->gc != gc) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1394 continue; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1395 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1396 if (!g_strcasecmp(who, normalize (b->name))) { /* find someone to pounce */ |
1857
9ea0b9531bc9
[gaim-migrate @ 1867]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1825
diff
changeset
|
1397 if (b->options & OPT_POUNCE_POPUP) { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1398 c = gaim_find_conversation(name); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1399 |
1 | 1400 if (c == NULL) |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1401 c = gaim_conversation_new(GAIM_CONV_IM, name); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1402 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1403 gaim_conversation_set_user(c, u); |
1 | 1404 } |
2550 | 1405 if (b->options & OPT_POUNCE_NOTIFY) { |
1406 char tmp[1024]; | |
1407 | |
1408 /* I know the line below is really ugly. I only did it this way | |
1409 * because I thought it'd be funny :-) */ | |
1410 | |
4276 | 1411 g_snprintf(tmp, sizeof(tmp), |
1412 (when & OPT_POUNCE_TYPING) ? _("%s has started typing to you") : | |
1413 (when & OPT_POUNCE_SIGNON) ? _("%s has signed on") : | |
1414 (when & OPT_POUNCE_UNIDLE) ? _("%s has returned from being idle") : | |
1415 _("%s has returned from being away"), name); | |
2993 | 1416 |
3427 | 1417 do_error_dialog(tmp, NULL, GAIM_INFO); |
2550 | 1418 } |
1857
9ea0b9531bc9
[gaim-migrate @ 1867]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1825
diff
changeset
|
1419 if (b->options & OPT_POUNCE_SEND_IM) { |
2550 | 1420 if (strlen(b->message) > 0) { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1421 c = gaim_find_conversation(name); |
2552 | 1422 |
1423 if (c == NULL) | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1424 c = gaim_conversation_new(GAIM_CONV_IM, name); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1425 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1426 gaim_conversation_set_user(c, u); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1427 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1428 gaim_conversation_write(c, NULL, b->message, -1, |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1429 WFLAG_SEND, time(NULL)); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1430 |
3033 | 1431 serv_send_im(u->gc, name, b->message, -1, 0); |
2550 | 1432 } |
1 | 1433 } |
1857
9ea0b9531bc9
[gaim-migrate @ 1867]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1825
diff
changeset
|
1434 if (b->options & OPT_POUNCE_COMMAND) { |
3630 | 1435 #ifndef _WIN32 |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1183
diff
changeset
|
1436 int pid = fork(); |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1183
diff
changeset
|
1437 |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1183
diff
changeset
|
1438 if (pid == 0) { |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1183
diff
changeset
|
1439 char *args[4]; |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1183
diff
changeset
|
1440 args[0] = "sh"; |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1183
diff
changeset
|
1441 args[1] = "-c"; |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1183
diff
changeset
|
1442 args[2] = b->command; |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1183
diff
changeset
|
1443 args[3] = NULL; |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1183
diff
changeset
|
1444 execvp(args[0], args); |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1183
diff
changeset
|
1445 _exit(0); |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1183
diff
changeset
|
1446 } |
3630 | 1447 #endif /*_WIN32*/ |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1183
diff
changeset
|
1448 } |
1857
9ea0b9531bc9
[gaim-migrate @ 1867]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1825
diff
changeset
|
1449 if (b->options & OPT_POUNCE_SOUND) { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1450 if (strlen(b->sound)) |
1857
9ea0b9531bc9
[gaim-migrate @ 1867]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1825
diff
changeset
|
1451 play_file(b->sound); |
1694 | 1452 else |
3060 | 1453 play_sound(SND_POUNCE_DEFAULT); |
1694 | 1454 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1455 |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1456 if (!(b->options & OPT_POUNCE_SAVE)) |
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1457 rem_bp(NULL, b); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1458 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1459 } |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1460 } |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1461 g_free(who); |
1 | 1462 } |
1463 | |
2569
a714b8223228
[gaim-migrate @ 2582]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2564
diff
changeset
|
1464 static void new_bp_callback(GtkWidget *w, struct buddy *b) |
1 | 1465 { |
2569
a714b8223228
[gaim-migrate @ 2582]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2564
diff
changeset
|
1466 if (b) |
4349 | 1467 show_new_bp(b->name, b->user->gc, b->idle, b->uc & UC_UNAVAILABLE, NULL); |
2569
a714b8223228
[gaim-migrate @ 2582]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2564
diff
changeset
|
1468 else |
2986 | 1469 show_new_bp(NULL, NULL, 0, 0, NULL); |
1 | 1470 } |
1471 | |
2986 | 1472 static void edit_bp_callback(GtkWidget *w, struct buddy_pounce *b) |
1473 { | |
1474 show_new_bp(NULL, NULL, 0, 0, b); | |
1475 } | |
1476 | |
1477 static GtkTooltips *bp_tooltip = NULL; | |
1 | 1478 void do_bp_menu() |
1479 { | |
1480 GtkWidget *menuitem, *mess, *messmenu; | |
1481 static GtkWidget *remmenu; | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1482 GtkWidget *remitem; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1483 GtkWidget *sep; |
1 | 1484 GList *l; |
1485 struct buddy_pounce *b; | |
1486 GList *bp = buddy_pounces; | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1487 |
2986 | 1488 /* Tooltip for editing bp's */ |
1489 if(!bp_tooltip) | |
1490 bp_tooltip = gtk_tooltips_new(); | |
1491 | |
1 | 1492 l = gtk_container_children(GTK_CONTAINER(bpmenu)); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1493 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1494 while (l) { |
1 | 1495 gtk_widget_destroy(GTK_WIDGET(l->data)); |
1496 l = l->next; | |
1497 } | |
1498 | |
1499 remmenu = gtk_menu_new(); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1500 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1501 menuitem = gtk_menu_item_new_with_label(_("New Buddy Pounce")); |
1 | 1502 gtk_menu_append(GTK_MENU(bpmenu), menuitem); |
1503 gtk_widget_show(menuitem); | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
1504 g_signal_connect(GTK_OBJECT(menuitem), "activate", G_CALLBACK(new_bp_callback), NULL); |
1 | 1505 |
1506 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1507 while (bp) { |
1 | 1508 |
1509 b = (struct buddy_pounce *)bp->data; | |
1510 remitem = gtk_menu_item_new_with_label(b->name); | |
1511 gtk_menu_append(GTK_MENU(remmenu), remitem); | |
1512 gtk_widget_show(remitem); | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
1513 g_signal_connect(GTK_OBJECT(remitem), "activate", G_CALLBACK(rem_bp), b); |
1 | 1514 |
1515 bp = bp->next; | |
1516 | |
1517 } | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1518 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1519 menuitem = gtk_menu_item_new_with_label(_("Remove Buddy Pounce")); |
1 | 1520 gtk_menu_append(GTK_MENU(bpmenu), menuitem); |
1521 gtk_widget_show(menuitem); | |
1522 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), remmenu); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1523 gtk_widget_show(remmenu); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1524 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1525 sep = gtk_hseparator_new(); |
1 | 1526 menuitem = gtk_menu_item_new(); |
1527 gtk_menu_append(GTK_MENU(bpmenu), menuitem); | |
1528 gtk_container_add(GTK_CONTAINER(menuitem), sep); | |
1529 gtk_widget_set_sensitive(menuitem, FALSE); | |
1530 gtk_widget_show(menuitem); | |
1531 gtk_widget_show(sep); | |
1532 | |
1138 | 1533 bp = buddy_pounces; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1534 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1535 while (bp) { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1536 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1537 b = (struct buddy_pounce *)bp->data; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1538 |
1 | 1539 menuitem = gtk_menu_item_new_with_label(b->name); |
1540 gtk_menu_append(GTK_MENU(bpmenu), menuitem); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1541 messmenu = gtk_menu_new(); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1542 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), messmenu); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1543 gtk_widget_show(menuitem); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1544 |
4154 | 1545 if (strlen(b->message)) |
1546 mess = gtk_menu_item_new_with_label(b->message); | |
1547 else | |
4155 | 1548 mess = gtk_menu_item_new_with_label(_("[no message]")); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1549 gtk_menu_append(GTK_MENU(messmenu), mess); |
2986 | 1550 gtk_tooltips_set_tip(bp_tooltip, GTK_WIDGET(mess), _("[Click to edit]"), NULL); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1551 gtk_widget_show(mess); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
1552 g_signal_connect(GTK_OBJECT(mess), "activate", G_CALLBACK(edit_bp_callback), b); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1553 bp = bp->next; |
1 | 1554 |
1555 } | |
1556 | |
1557 } | |
1558 | |
1559 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1560 static struct group_show *find_group_show(char *group) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1561 { |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1562 GSList *m = shows; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1563 struct group_show *g = NULL; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1564 char *who = g_strdup(normalize (group)); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1565 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1566 while (m) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1567 g = (struct group_show *)m->data; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1568 if (!g_strcasecmp(normalize (g->name), who)) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1569 break; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1570 g = NULL; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1571 m = m->next; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1572 } |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
1573 g_free(who); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1574 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1575 return g; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1576 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1577 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1578 static struct buddy_show *find_buddy_show(struct group_show *gs, char *name) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1579 { |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1580 GSList *m = gs->members; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1581 struct buddy_show *b = NULL; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1582 char *who = g_strdup(normalize (name)); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1583 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1584 while (m) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1585 b = (struct buddy_show *)m->data; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1586 if (!g_strcasecmp(normalize (b->name), who)) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1587 break; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1588 b = NULL; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1589 m = m->next; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1590 } |
1098
b335c0ce305e
[gaim-migrate @ 1108]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1097
diff
changeset
|
1591 g_free(who); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1592 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1593 return b; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1594 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1595 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1596 static int group_number(char *group) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1597 { |
1037
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1598 GSList *m; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1599 struct group *p; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1600 int pos = 0; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1601 |
4349 | 1602 m = groups; |
1603 while (m) { | |
1604 p = (struct group *)m->data; | |
1605 if (!strcmp(p->name, group)) | |
1606 return pos; | |
1607 if (find_group_show(p->name)) | |
1608 pos++; | |
1609 m = m->next; | |
1037
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1610 } |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1611 /* um..... we'll never get here */ |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1612 return -1; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1613 } |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1614 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1615 static int buddy_number(char *group, char *buddy) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1616 { |
1037
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1617 struct group *p; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1618 GSList *z; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1619 struct buddy *b; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1620 int pos = 0; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1621 char *tmp1 = g_strdup(normalize (buddy)); |
1037
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1622 struct group_show *gs = find_group_show(group); |
4349 | 1623 struct buddy_show *bs; |
1624 GSList *seen = NULL; | |
1625 | |
1626 p = find_group(group); | |
1627 if(p) { | |
1037
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1628 z = p->members; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1629 while (z) { |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1630 b = (struct buddy *)z->data; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1631 if (!strcmp(tmp1, normalize (b->name))) { |
1037
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1632 g_free(tmp1); |
4349 | 1633 g_slist_free(seen); |
1037
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1634 return pos; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1635 } |
4349 | 1636 if ((bs = find_buddy_show(gs, b->name))) { |
1637 if(!g_slist_find(seen, bs)) { | |
1638 seen = g_slist_append(seen, bs); | |
1639 pos++; | |
1640 } | |
1641 } | |
1037
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1642 z = z->next; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1643 } |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1644 } |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1645 /* we shouldn't ever get here */ |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1646 debug_printf("got to bad place in buddy_number\n"); |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1647 g_free(tmp1); |
4349 | 1648 g_slist_free(seen); |
1037
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1649 return -1; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1650 } |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1651 |
3131 | 1652 |
1653 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1654 static struct group_show *new_group_show(char *group) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1655 { |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1656 struct group_show *g = g_new0(struct group_show, 1); |
1037
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1657 int pos = group_number(group); |
3131 | 1658 GdkPixmap *pm; |
1659 GdkBitmap *bm; | |
1660 GtkStyle *style; | |
1661 GtkStyle *style2; | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1662 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1663 g->name = g_strdup(group); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1664 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1665 g->item = gtk_tree_item_new(); |
3131 | 1666 |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
1667 g_signal_connect(GTK_OBJECT(g->item), "button_press_event", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
1668 G_CALLBACK(handle_click_group), g); |
3131 | 1669 |
1670 gtk_tree_insert(GTK_TREE(buddies), g->item, pos); | |
1671 | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1672 gtk_widget_show(g->item); |
1 | 1673 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1674 g->label = gtk_label_new(group); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1675 gtk_misc_set_alignment(GTK_MISC(g->label), 0.0, 0.5); |
3131 | 1676 gtk_widget_show(g->label); |
1677 | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1678 gtk_container_add(GTK_CONTAINER(g->item), g->label); |
3131 | 1679 |
1037
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1680 shows = g_slist_insert(shows, g, pos); |
3131 | 1681 |
1682 /* Rob does drugs - this is still evil, damn you becausse I SAID SO! */ | |
1683 | |
1684 pm = gdk_pixmap_create_from_xpm_d(g->item->window, | |
1685 &bm, NULL, arrow_down_xpm); | |
1686 | |
1687 gtk_pixmap_set(GTK_PIXMAP(GTK_TREE_ITEM(g->item)->minus_pix_widget), | |
1688 pm, bm); | |
1689 | |
1690 gdk_pixmap_unref(pm); | |
1691 gdk_bitmap_unref(bm); | |
1692 | |
1693 pm = gdk_pixmap_create_from_xpm_d(buddies->window, | |
1694 &bm, NULL, arrow_right_xpm); | |
1695 | |
1696 gtk_pixmap_set(GTK_PIXMAP(GTK_TREE_ITEM(g->item)->plus_pix_widget), | |
1697 pm, bm); | |
1698 | |
1699 gdk_pixmap_unref(pm); | |
1700 gdk_bitmap_unref(bm); | |
1701 | |
3133 | 1702 // style = gtk_widget_get_style(GTK_TREE_ITEM(g->item)->pixmaps_box); |
1703 style2 = gtk_style_copy(gtk_widget_get_style(g->item)); | |
1704 style = gtk_style_copy(gtk_widget_get_style(GTK_WIDGET(g->label))); | |
3137 | 1705 |
3131 | 1706 style->bg[0] = style2->base[0]; |
1707 gtk_widget_set_style(GTK_TREE_ITEM(g->item)->pixmaps_box, style); | |
1708 | |
3137 | 1709 gtk_style_unref(style); |
1710 gtk_style_unref(style2); | |
1711 | |
3131 | 1712 /* bad drugs */ |
1713 | |
2883
c12e3e66d54a
[gaim-migrate @ 2896]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2856
diff
changeset
|
1714 update_num_group(g); |
3131 | 1715 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1716 return g; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1717 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1718 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1719 static struct buddy_show *new_buddy_show(struct group_show *gs, struct buddy *buddy, char **xpm) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1720 { |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1721 struct buddy_show *b = g_new0(struct buddy_show, 1); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1722 GtkWidget *box; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1723 GdkPixmap *pm; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1724 GdkBitmap *bm; |
1037
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1725 int pos = buddy_number(gs->name, buddy->name); |
1299
18c3874ea051
[gaim-migrate @ 1309]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1297
diff
changeset
|
1726 b->sound = 0; |
1 | 1727 |
1409
17e544f8c7fb
[gaim-migrate @ 1419]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1401
diff
changeset
|
1728 if (gs->members == NULL) { |
17e544f8c7fb
[gaim-migrate @ 1419]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1401
diff
changeset
|
1729 gs->tree = gtk_tree_new(); |
17e544f8c7fb
[gaim-migrate @ 1419]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1401
diff
changeset
|
1730 gtk_tree_item_set_subtree(GTK_TREE_ITEM(gs->item), gs->tree); |
17e544f8c7fb
[gaim-migrate @ 1419]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1401
diff
changeset
|
1731 gtk_tree_item_expand(GTK_TREE_ITEM(gs->item)); |
17e544f8c7fb
[gaim-migrate @ 1419]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1401
diff
changeset
|
1732 gtk_widget_show(gs->tree); |
17e544f8c7fb
[gaim-migrate @ 1419]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1401
diff
changeset
|
1733 } |
17e544f8c7fb
[gaim-migrate @ 1419]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1401
diff
changeset
|
1734 |
1036
faa5afc2b89e
[gaim-migrate @ 1046]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1033
diff
changeset
|
1735 b->name = g_strdup(buddy->name); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1736 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1737 b->item = gtk_tree_item_new(); |
1037
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1738 gtk_tree_insert(GTK_TREE(gs->tree), b->item, pos); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1739 gtk_object_set_user_data(GTK_OBJECT(b->item), b); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
1740 g_signal_connect(GTK_OBJECT(b->item), "button_press_event", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
1741 G_CALLBACK(handle_click_buddy), b); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1742 gtk_widget_show(b->item); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1743 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1744 box = gtk_hbox_new(FALSE, 1); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1745 gtk_container_add(GTK_CONTAINER(b->item), box); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1746 gtk_widget_show(box); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1747 |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1714
diff
changeset
|
1748 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, NULL, xpm ? xpm : no_icon_xpm); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1749 b->pix = gtk_pixmap_new(pm, bm); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1750 gtk_box_pack_start(GTK_BOX(box), b->pix, FALSE, FALSE, 1); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1751 gtk_widget_show(b->pix); |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2281
diff
changeset
|
1752 if (!(blist_options & OPT_BLIST_SHOW_PIXMAPS)) |
1711
9b86520e04ac
[gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1699
diff
changeset
|
1753 gtk_widget_hide(b->pix); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1754 gdk_pixmap_unref(pm); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1755 gdk_bitmap_unref(bm); |
1 | 1756 |
4227 | 1757 b->label = gtk_label_new(get_buddy_alias(buddy)); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1758 gtk_misc_set_alignment(GTK_MISC(b->label), 0.0, 0.5); |
1242
8cb5c1000ea9
[gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
1759 gtk_box_pack_start(GTK_BOX(box), b->label, FALSE, FALSE, 1); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1760 gtk_widget_show(b->label); |
1 | 1761 |
1242
8cb5c1000ea9
[gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
1762 b->warn = gtk_label_new(""); |
8cb5c1000ea9
[gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
1763 gtk_box_pack_start(GTK_BOX(box), b->warn, FALSE, FALSE, 1); |
8cb5c1000ea9
[gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
1764 gtk_widget_show(b->warn); |
8cb5c1000ea9
[gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
1765 |
1058
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1766 b->idle = gtk_label_new(""); |
1242
8cb5c1000ea9
[gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
1767 gtk_box_pack_end(GTK_BOX(box), b->idle, FALSE, FALSE, 1); |
1058
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1768 gtk_widget_show(b->idle); |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1769 |
1037
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1770 gs->members = g_slist_insert(gs->members, b, pos); |
1070
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
1771 update_num_group(gs); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1772 return b; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1773 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1774 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1775 static void remove_buddy_show(struct group_show *gs, struct buddy_show *bs) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1776 { |
1108
cb338aa38e78
[gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
1777 /* the name of this function may be misleading, but don't let it fool you. the point |
cb338aa38e78
[gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
1778 * of this is to remove bs->item from gs->tree, and make sure gs->tree still exists |
cb338aa38e78
[gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
1779 * and is a valid tree afterwards. Otherwise, Bad Things will happen. */ |
cb338aa38e78
[gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
1780 gtk_tree_remove_item(GTK_TREE(gs->tree), bs->item); |
cb338aa38e78
[gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
1781 bs->item = NULL; |
cb338aa38e78
[gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
1782 } |
cb338aa38e78
[gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
1783 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1784 static struct group_show *find_gs_by_bs(struct buddy_show *b) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1785 { |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1786 GSList *m, *n; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1787 struct group_show *g = NULL; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1788 struct buddy_show *h; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1789 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1790 m = shows; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1791 while (m) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1792 g = (struct group_show *)m->data; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1793 n = g->members; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1794 while (n) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1795 h = (struct buddy_show *)n->data; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1796 if (h == b) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1797 return g; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1798 n = n->next; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1799 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1800 g = NULL; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1801 m = m->next; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1802 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1803 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1804 return g; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1805 } |
1 | 1806 |
3472 | 1807 /* used by this file, and by iconaway.so */ |
3188 | 1808 void hide_buddy_list() { |
3510 | 1809 if (blist) { |
3517 | 1810 if (!connections || docklet_count) { |
3970
3bc436a24548
[gaim-migrate @ 4154]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3948
diff
changeset
|
1811 #ifdef _WIN32 |
3bc436a24548
[gaim-migrate @ 4154]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3948
diff
changeset
|
1812 /* minimize to systray with effects */ |
3bc436a24548
[gaim-migrate @ 4154]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3948
diff
changeset
|
1813 wgaim_systray_minimize(blist); |
3bc436a24548
[gaim-migrate @ 4154]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3948
diff
changeset
|
1814 #endif |
3510 | 1815 gtk_widget_hide(blist); |
1816 } else { | |
1817 gtk_window_iconify(GTK_WINDOW(blist)); | |
3472 | 1818 } |
1819 } | |
1820 } | |
1821 | |
1822 /* mostly used by code in this file */ | |
1823 void unhide_buddy_list() { | |
3510 | 1824 if (blist) { |
4108 | 1825 if (!GTK_WIDGET_VISIBLE(blist) && blist_options & OPT_BLIST_SAVED_WINDOWS && |
1826 blist_pos.width != 0) { | |
3939 | 1827 /* don't move it off screen */ |
1828 if (blist_pos.x >= gdk_screen_width()) { | |
1829 blist_pos.x = gdk_screen_width() - 100; | |
4402 | 1830 } else if (blist_pos.x < 0) { |
3939 | 1831 blist_pos.x = 100; |
1832 } | |
1833 | |
1834 if (blist_pos.y >= gdk_screen_height()) { | |
1835 blist_pos.y = gdk_screen_height() - 100; | |
4402 | 1836 } else if (blist_pos.y < 0) { |
3939 | 1837 blist_pos.y = 100; |
1838 } | |
1839 | |
3540 | 1840 gtk_window_move(GTK_WINDOW(blist), blist_pos.x, blist_pos.y); |
1841 gtk_window_resize(GTK_WINDOW(blist), blist_pos.width, blist_pos.height); | |
3510 | 1842 } |
3939 | 1843 |
1844 gtk_window_present(GTK_WINDOW(blist)); | |
3472 | 1845 } |
1846 } | |
1847 | |
1848 /* for the delete_event handler */ | |
1849 static void close_buddy_list() { | |
3517 | 1850 if (docklet_count) { |
3472 | 1851 hide_buddy_list(); |
1852 } else { | |
1853 do_quit(); | |
1854 } | |
1855 } | |
1856 | |
1857 void docklet_add() { | |
3517 | 1858 docklet_count++; |
3519 | 1859 debug_printf("docklet_count: %d\n",docklet_count); |
3472 | 1860 } |
1861 | |
1862 void docklet_remove() { | |
3726 | 1863 docklet_count--; |
3519 | 1864 debug_printf("docklet_count: %d\n",docklet_count); |
3517 | 1865 if (!docklet_count) { |
3472 | 1866 if (connections) { |
1867 unhide_buddy_list(); | |
1868 } else { | |
1869 gtk_window_present(GTK_WINDOW(mainwindow)); | |
1870 } | |
1871 } | |
3192 | 1872 } |
1873 | |
3570 | 1874 void docklet_toggle() { |
1875 /* Useful for the docklet plugin and also for the win32 tray icon*/ | |
1876 /* This is called when one of those is clicked--it will show/hide the | |
1877 buddy list/login window--depending on which is active */ | |
3726 | 1878 if (connections && blist) { |
3570 | 1879 if (GTK_WIDGET_VISIBLE(blist)) { |
3939 | 1880 if (GAIM_WINDOW_ICONIFIED(blist) || obscured) { |
3570 | 1881 unhide_buddy_list(); |
1882 } else { | |
1883 hide_buddy_list(); | |
1884 } | |
1885 } else { | |
3970
3bc436a24548
[gaim-migrate @ 4154]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3948
diff
changeset
|
1886 #if _WIN32 |
3bc436a24548
[gaim-migrate @ 4154]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3948
diff
changeset
|
1887 wgaim_systray_maximize(blist); |
3bc436a24548
[gaim-migrate @ 4154]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3948
diff
changeset
|
1888 #endif |
3570 | 1889 unhide_buddy_list(); |
1890 } | |
3726 | 1891 } else if (connections) { |
1892 /* we're logging in or something... do nothing */ | |
1893 debug_printf("docklet_toggle called with connections but no blist!\n"); | |
3570 | 1894 } else { |
1895 if (GTK_WIDGET_VISIBLE(mainwindow)) { | |
1896 if (GAIM_WINDOW_ICONIFIED(mainwindow)) { | |
1897 gtk_window_present(GTK_WINDOW(mainwindow)); | |
1898 } else { | |
3970
3bc436a24548
[gaim-migrate @ 4154]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3948
diff
changeset
|
1899 #if _WIN32 |
3bc436a24548
[gaim-migrate @ 4154]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3948
diff
changeset
|
1900 wgaim_systray_minimize(mainwindow); |
3bc436a24548
[gaim-migrate @ 4154]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3948
diff
changeset
|
1901 #endif |
3570 | 1902 gtk_widget_hide(mainwindow); |
1903 } | |
1904 } else { | |
3970
3bc436a24548
[gaim-migrate @ 4154]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3948
diff
changeset
|
1905 #if _WIN32 |
3bc436a24548
[gaim-migrate @ 4154]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3948
diff
changeset
|
1906 wgaim_systray_maximize(mainwindow); |
3bc436a24548
[gaim-migrate @ 4154]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3948
diff
changeset
|
1907 #endif |
3570 | 1908 gtk_window_present(GTK_WINDOW(mainwindow)); |
1909 } | |
1910 } | |
1911 } | |
1912 | |
4168 | 1913 static gboolean log_timeout(gpointer data) |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1914 { |
4168 | 1915 struct buddy_show *b = data; |
2255
aaa82fd67a7b
[gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2191
diff
changeset
|
1916 /* this part is really just a bad hack because of a bug I can't find */ |
aaa82fd67a7b
[gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2191
diff
changeset
|
1917 GSList *s = shows; |
aaa82fd67a7b
[gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2191
diff
changeset
|
1918 while (s) { |
aaa82fd67a7b
[gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2191
diff
changeset
|
1919 struct group_show *gs = s->data; |
aaa82fd67a7b
[gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2191
diff
changeset
|
1920 GSList *m = gs->members; |
aaa82fd67a7b
[gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2191
diff
changeset
|
1921 while (m) { |
aaa82fd67a7b
[gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2191
diff
changeset
|
1922 if (b == m->data) |
aaa82fd67a7b
[gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2191
diff
changeset
|
1923 break; |
aaa82fd67a7b
[gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2191
diff
changeset
|
1924 m = m->next; |
aaa82fd67a7b
[gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2191
diff
changeset
|
1925 } |
aaa82fd67a7b
[gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2191
diff
changeset
|
1926 if (m != NULL) |
aaa82fd67a7b
[gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2191
diff
changeset
|
1927 break; |
aaa82fd67a7b
[gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2191
diff
changeset
|
1928 s = s->next; |
aaa82fd67a7b
[gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2191
diff
changeset
|
1929 } |
aaa82fd67a7b
[gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2191
diff
changeset
|
1930 if (!s) |
4168 | 1931 return FALSE; |
2255
aaa82fd67a7b
[gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2191
diff
changeset
|
1932 |
aaa82fd67a7b
[gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2191
diff
changeset
|
1933 /* this is the real part. */ |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1934 if (!b->connlist) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1935 struct group_show *g = find_gs_by_bs(b); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1936 g->members = g_slist_remove(g->members, b); |
1091
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
1937 if (blist) |
1108
cb338aa38e78
[gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
1938 remove_buddy_show(g, b); |
1091
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
1939 else |
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
1940 debug_printf("log_timeout but buddy list not available\n"); |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2281
diff
changeset
|
1941 if ((g->members == NULL) && (blist_options & OPT_BLIST_NO_MT_GRP)) { |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1942 shows = g_slist_remove(shows, g); |
1091
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
1943 if (blist) |
1108
cb338aa38e78
[gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
1944 gtk_tree_remove_item(GTK_TREE(buddies), g->item); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1945 g_free(g->name); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1946 g_free(g); |
1089
f0f5c10cce63
[gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1088
diff
changeset
|
1947 } |
4168 | 1948 g_source_remove(b->log_timer); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
1949 b->log_timer = 0; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1950 g_free(b->name); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1951 g_free(b); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1952 } else { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1953 /* um.... what do we have to do here? just update the pixmap? */ |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1954 GdkPixmap *pm; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1955 GdkBitmap *bm; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1956 gchar **xpm = NULL; |
4349 | 1957 struct gaim_connection *gc = b->connlist->data; |
1958 struct buddy *light = find_buddy(gc->user, b->name); | |
1959 if (gc->prpl->list_icon) | |
1960 xpm = gc->prpl->list_icon(light->uc); | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1961 if (xpm == NULL) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1962 xpm = (char **)no_icon_xpm; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1963 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, NULL, xpm); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1964 gtk_widget_hide(b->pix); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1965 gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1966 gtk_widget_show(b->pix); |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2281
diff
changeset
|
1967 if (!(blist_options & OPT_BLIST_SHOW_PIXMAPS)) |
1711
9b86520e04ac
[gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1699
diff
changeset
|
1968 gtk_widget_hide(b->pix); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1969 gdk_pixmap_unref(pm); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1970 gdk_bitmap_unref(bm); |
4168 | 1971 g_source_remove(b->log_timer); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
1972 b->log_timer = 0; |
1299
18c3874ea051
[gaim-migrate @ 1309]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1297
diff
changeset
|
1973 b->sound = 0; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1974 } |
4168 | 1975 return FALSE; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1976 } |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1977 |
2920 | 1978 static char *caps_string(guint caps) |
1068
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1979 { |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1980 static char buf[256], *tmp; |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1981 int count = 0, i = 0; |
2920 | 1982 guint bit = 1; |
1983 while (bit <= 0x10000) { | |
1068
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1984 if (bit & caps) { |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1985 switch (bit) { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1986 case 0x1: |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1987 tmp = _("Buddy Icon"); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1988 break; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1989 case 0x2: |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1990 tmp = _("Voice"); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1991 break; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1992 case 0x4: |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1993 tmp = _("IM Image"); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1994 break; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1995 case 0x8: |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1996 tmp = _("Chat"); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1997 break; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1998 case 0x10: |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
1999 tmp = _("Get File"); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2000 break; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2001 case 0x20: |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2002 tmp = _("Send File"); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2003 break; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2004 case 0x40: |
2669 | 2005 case 0x200: |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2006 tmp = _("Games"); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2007 break; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2008 case 0x80: |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2009 tmp = _("Stocks"); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2010 break; |
2920 | 2011 case 0x100: |
2012 tmp = _("Send Buddy List"); | |
2013 break; | |
2669 | 2014 case 0x400: |
2015 tmp = _("EveryBuddy Bug"); | |
2016 break; | |
2734
9fc65bb80596
[gaim-migrate @ 2747]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2731
diff
changeset
|
2017 case 0x800: |
9fc65bb80596
[gaim-migrate @ 2747]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2731
diff
changeset
|
2018 tmp = _("AP User"); |
9fc65bb80596
[gaim-migrate @ 2747]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2731
diff
changeset
|
2019 break; |
2920 | 2020 case 0x1000: |
2021 tmp = _("ICQ RTF"); | |
2022 break; | |
2023 case 0x2000: | |
2024 tmp = _("Nihilist"); | |
2025 break; | |
2026 case 0x4000: | |
2027 tmp = _("ICQ Server Relay"); | |
2028 break; | |
2029 case 0x8000: | |
2030 tmp = _("ICQ Unknown"); | |
2031 break; | |
2032 case 0x10000: | |
2033 tmp = _("Trillian Encryption"); | |
2034 break; | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2035 default: |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2036 tmp = NULL; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2037 break; |
1068
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
2038 } |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
2039 if (tmp) |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2040 i += g_snprintf(buf + i, sizeof(buf) - i, "%s%s", (count ? ", " : ""), |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2041 tmp); |
1068
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
2042 count++; |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
2043 } |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
2044 bit <<= 1; |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
2045 } |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
2046 return buf; |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
2047 } |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
2048 |
1163
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
2049 /* for this we're just going to assume the first connection that registered the buddy. |
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
2050 * if it's not the one you were hoping for then you're shit out of luck */ |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2051 static void update_idle_time(struct buddy_show *bs) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2052 { |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1072
diff
changeset
|
2053 /* this also updates the tooltip since that has idle time in it */ |
1242
8cb5c1000ea9
[gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
2054 char idlet[16], warnl[16]; |
1058
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
2055 time_t t; |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
2056 int ihrs, imin; |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
2057 struct buddy *b; |
2592
f194dd8250d4
[gaim-migrate @ 2605]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2587
diff
changeset
|
2058 GtkStyle *style; |
1058
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
2059 |
1163
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
2060 char infotip[2048]; |
1068
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
2061 char warn[256]; |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
2062 char caps[256]; |
4227 | 2063 char alias[512]; |
2064 char serv_alias[512]; | |
1815
f15d449b3167
[gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1805
diff
changeset
|
2065 char *sotime = NULL, *itime; |
1068
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
2066 |
4349 | 2067 struct gaim_connection *gc; |
2068 | |
2731
e9e624d8803e
[gaim-migrate @ 2744]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2730
diff
changeset
|
2069 int i; |
e9e624d8803e
[gaim-migrate @ 2744]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2730
diff
changeset
|
2070 |
1058
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
2071 time(&t); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2072 if (!bs->connlist) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2073 return; |
4349 | 2074 gc = bs->connlist->data; |
2075 b = find_buddy(gc->user, bs->name); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2076 if (!b) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2077 return; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2078 ihrs = (t - b->idle) / 3600; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2079 imin = ((t - b->idle) / 60) % 60; |
1058
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
2080 |
1163
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
2081 if (ihrs) |
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
2082 g_snprintf(idlet, sizeof idlet, "(%d:%02d)", ihrs, imin); |
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
2083 else |
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
2084 g_snprintf(idlet, sizeof idlet, "(%d)", imin); |
1058
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
2085 |
1163
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
2086 gtk_widget_hide(bs->idle); |
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
2087 if (b->idle) |
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
2088 gtk_label_set(GTK_LABEL(bs->idle), idlet); |
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
2089 else |
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
2090 gtk_label_set(GTK_LABEL(bs->idle), ""); |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2281
diff
changeset
|
2091 if (blist_options & OPT_BLIST_SHOW_IDLETIME) |
1163
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
2092 gtk_widget_show(bs->idle); |
1068
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
2093 |
2730
a9aabf1170f1
[gaim-migrate @ 2743]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
2094 style = gtk_style_new(); |
a9aabf1170f1
[gaim-migrate @ 2743]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
2095 gtk_style_set_font(style, gdk_font_ref(gtk_style_get_font(bs->label->style))); |
2731
e9e624d8803e
[gaim-migrate @ 2744]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2730
diff
changeset
|
2096 for (i = 0; i < 5; i++) |
2736
6e1ac8ceb3c4
[gaim-migrate @ 2749]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2097 style->fg[i] = bs->idle->style->fg[i]; |
2610
98928712e319
[gaim-migrate @ 2623]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2607
diff
changeset
|
2098 if ((blist_options & OPT_BLIST_GREY_IDLERS) && (b->idle)) { |
2592
f194dd8250d4
[gaim-migrate @ 2605]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2587
diff
changeset
|
2099 style->fg[GTK_STATE_NORMAL].red = |
2613
6f7e1fc3e132
[gaim-migrate @ 2626]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2610
diff
changeset
|
2100 (style->fg[GTK_STATE_NORMAL].red / 2) + (style->base[GTK_STATE_NORMAL].red / 2); |
2592
f194dd8250d4
[gaim-migrate @ 2605]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2587
diff
changeset
|
2101 style->fg[GTK_STATE_NORMAL].green = |
2613
6f7e1fc3e132
[gaim-migrate @ 2626]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2610
diff
changeset
|
2102 (style->fg[GTK_STATE_NORMAL].green / 2) + (style->base[GTK_STATE_NORMAL].green / 2); |
2592
f194dd8250d4
[gaim-migrate @ 2605]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2587
diff
changeset
|
2103 style->fg[GTK_STATE_NORMAL].blue = |
2613
6f7e1fc3e132
[gaim-migrate @ 2626]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2610
diff
changeset
|
2104 (style->fg[GTK_STATE_NORMAL].blue / 2) + (style->base[GTK_STATE_NORMAL].blue / 2); |
2592
f194dd8250d4
[gaim-migrate @ 2605]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2587
diff
changeset
|
2105 } |
f194dd8250d4
[gaim-migrate @ 2605]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2587
diff
changeset
|
2106 gtk_widget_set_style(bs->label, style); |
f194dd8250d4
[gaim-migrate @ 2605]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2587
diff
changeset
|
2107 gtk_style_unref(style); |
f194dd8250d4
[gaim-migrate @ 2605]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2587
diff
changeset
|
2108 |
1163
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
2109 /* now we do the tooltip */ |
1496
d33bf6548543
[gaim-migrate @ 1506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1477
diff
changeset
|
2110 if (b->signon) { |
d33bf6548543
[gaim-migrate @ 1506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1477
diff
changeset
|
2111 char *stime = sec_to_text(t - b->signon + |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2112 ((struct gaim_connection *)bs->connlist->data)-> |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2113 correction_time); |
1496
d33bf6548543
[gaim-migrate @ 1506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1477
diff
changeset
|
2114 sotime = g_strdup_printf(_("Logged in: %s\n"), stime); |
d33bf6548543
[gaim-migrate @ 1506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1477
diff
changeset
|
2115 g_free(stime); |
d33bf6548543
[gaim-migrate @ 1506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1477
diff
changeset
|
2116 } |
1068
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
2117 |
1163
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
2118 if (b->idle) |
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
2119 itime = sec_to_text(t - b->idle); |
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
2120 else { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2121 itime = g_malloc(1); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2122 itime[0] = 0; |
1163
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
2123 } |
1068
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
2124 |
1242
8cb5c1000ea9
[gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
2125 if (b->evil) { |
1163
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
2126 g_snprintf(warn, sizeof warn, _("Warnings: %d%%\n"), b->evil); |
1242
8cb5c1000ea9
[gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
2127 g_snprintf(warnl, sizeof warnl, "(%d%%)", b->evil); |
8cb5c1000ea9
[gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
2128 } else { |
1163
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
2129 warn[0] = '\0'; |
1242
8cb5c1000ea9
[gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
2130 warnl[0] = '\0'; |
8cb5c1000ea9
[gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
2131 } |
8cb5c1000ea9
[gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
2132 gtk_widget_hide(bs->warn); |
8cb5c1000ea9
[gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
2133 gtk_label_set(GTK_LABEL(bs->warn), warnl); |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2281
diff
changeset
|
2134 if (blist_options & OPT_BLIST_SHOW_WARN) |
1242
8cb5c1000ea9
[gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
2135 gtk_widget_show(bs->warn); |
1068
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
2136 |
1163
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
2137 if (b->caps) |
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
2138 g_snprintf(caps, sizeof caps, _("Capabilities: %s\n"), caps_string(b->caps)); |
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
2139 else |
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
2140 caps[0] = '\0'; |
1068
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
2141 |
4227 | 2142 if (b->alias[0]) |
2143 g_snprintf(alias, sizeof alias, _("Alias: %s\n"), b->alias); | |
2144 else | |
2145 alias[0] = '\0'; | |
2146 | |
2147 if (b->server_alias[0]) | |
2148 g_snprintf(serv_alias, sizeof serv_alias, _("Nickname: %s\n"), | |
2149 b->server_alias); | |
2150 else | |
2151 serv_alias[0] = '\0'; | |
2152 | |
2153 g_snprintf(infotip, sizeof infotip, _("%s%sScreen Name: %s\n%s%s%s%s%s%s"), | |
2154 alias, serv_alias, b->name, (b->signon ? sotime : ""), warn, | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2155 (b->idle ? _("Idle: ") : ""), itime, (b->idle ? "\n" : ""), caps); |
1068
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
2156 |
1163
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
2157 gtk_tooltips_set_tip(tips, GTK_WIDGET(bs->item), infotip, ""); |
1068
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
2158 |
1496
d33bf6548543
[gaim-migrate @ 1506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1477
diff
changeset
|
2159 if (b->signon) |
d33bf6548543
[gaim-migrate @ 1506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1477
diff
changeset
|
2160 g_free(sotime); |
1163
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
2161 g_free(itime); |
1058
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
2162 } |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
2163 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2164 void update_idle_times() |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2165 { |
1058
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
2166 GSList *grp = shows; |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
2167 GSList *mem; |
1667
b5635d882116
[gaim-migrate @ 1677]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1666
diff
changeset
|
2168 struct buddy_show *b; |
b5635d882116
[gaim-migrate @ 1677]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1666
diff
changeset
|
2169 struct group_show *g; |
1058
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
2170 |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
2171 while (grp) { |
1667
b5635d882116
[gaim-migrate @ 1677]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1666
diff
changeset
|
2172 g = (struct group_show *)grp->data; |
b5635d882116
[gaim-migrate @ 1677]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1666
diff
changeset
|
2173 mem = g->members; |
1058
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
2174 while (mem) { |
1667
b5635d882116
[gaim-migrate @ 1677]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1666
diff
changeset
|
2175 b = (struct buddy_show *)mem->data; |
b5635d882116
[gaim-migrate @ 1677]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1666
diff
changeset
|
2176 update_idle_time(b); |
1058
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
2177 mem = mem->next; |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
2178 } |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
2179 grp = grp->next; |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
2180 } |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
2181 } |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
2182 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2183 void set_buddy(struct gaim_connection *gc, struct buddy *b) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2184 { |
4349 | 2185 struct group *g = find_group_by_buddy(b); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2186 struct group_show *gs; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2187 struct buddy_show *bs; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2188 GdkPixmap *pm; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2189 GdkBitmap *bm; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2190 char **xpm = NULL; |
1058
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
2191 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2192 if (!blist) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2193 return; |
1063
e1408fb04c36
[gaim-migrate @ 1073]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1061
diff
changeset
|
2194 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2195 if (b->present) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2196 if ((gs = find_group_show(g->name)) == NULL) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2197 gs = new_group_show(g->name); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2198 if ((bs = find_buddy_show(gs, b->name)) == NULL) |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
2199 bs = new_buddy_show(gs, b, (char **)login_icon_xpm); |
2778
27c22147e023
[gaim-migrate @ 2791]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2736
diff
changeset
|
2200 if (!g_slist_find(bs->connlist, gc)) { |
1164
ed5bb86253c6
[gaim-migrate @ 1174]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1163
diff
changeset
|
2201 bs->connlist = g_slist_append(bs->connlist, gc); |
2778
27c22147e023
[gaim-migrate @ 2791]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2736
diff
changeset
|
2202 update_num_group(gs); |
27c22147e023
[gaim-migrate @ 2791]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2736
diff
changeset
|
2203 } |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2204 if (b->present == 1) { |
1299
18c3874ea051
[gaim-migrate @ 1309]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1297
diff
changeset
|
2205 if (bs->sound != 2) |
3060 | 2206 play_sound(SND_BUDDY_ARRIVE); |
3192 | 2207 if (blist_options & OPT_BLIST_POPUP) |
4280 | 2208 gdk_window_show(blist->window); |
1039
67ed2ee5be9f
[gaim-migrate @ 1049]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1037
diff
changeset
|
2209 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2210 NULL, (char **)login_icon_xpm); |
1039
67ed2ee5be9f
[gaim-migrate @ 1049]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1037
diff
changeset
|
2211 gtk_widget_hide(bs->pix); |
67ed2ee5be9f
[gaim-migrate @ 1049]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1037
diff
changeset
|
2212 gtk_pixmap_set(GTK_PIXMAP(bs->pix), pm, bm); |
67ed2ee5be9f
[gaim-migrate @ 1049]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1037
diff
changeset
|
2213 gtk_widget_show(bs->pix); |
67ed2ee5be9f
[gaim-migrate @ 1049]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1037
diff
changeset
|
2214 gdk_pixmap_unref(pm); |
67ed2ee5be9f
[gaim-migrate @ 1049]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1037
diff
changeset
|
2215 gdk_bitmap_unref(bm); |
121
3571b593f423
[gaim-migrate @ 131]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
120
diff
changeset
|
2216 b->present = 2; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
2217 if (bs->log_timer > 0) |
4168 | 2218 g_source_remove(bs->log_timer); |
2219 bs->log_timer = g_timeout_add(10000, log_timeout, bs); | |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2281
diff
changeset
|
2220 if ((bs->sound != 2) && (im_options & OPT_IM_LOGON)) { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
2221 struct gaim_conversation *c = gaim_find_conversation(b->name); |
1066
d6c70d58a4b2
[gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
2222 if (c) { |
d6c70d58a4b2
[gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
2223 char tmp[1024]; |
4227 | 2224 g_snprintf(tmp, sizeof(tmp), _("%s logged in."), |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
2225 get_buddy_alias(b)); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
2226 gaim_conversation_write(c, NULL, tmp, -1, |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
2227 WFLAG_SYSTEM, time(NULL)); |
4412 | 2228 } else if (awayqueue && find_queue_total_by_name(b->name)) { |
2906
538c58b43eff
[gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2886
diff
changeset
|
2229 struct queued_message *qm = g_new0(struct queued_message, 1); |
2979 | 2230 g_snprintf(qm->name, sizeof(qm->name), "%s", b->name); |
4227 | 2231 qm->message = g_strdup_printf(_("%s logged in."), |
2232 get_buddy_alias(b)); | |
2906
538c58b43eff
[gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2886
diff
changeset
|
2233 qm->gc = gc; |
538c58b43eff
[gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2886
diff
changeset
|
2234 qm->tm = time(NULL); |
538c58b43eff
[gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2886
diff
changeset
|
2235 qm->flags = WFLAG_SYSTEM; |
538c58b43eff
[gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2886
diff
changeset
|
2236 qm->len = -1; |
538c58b43eff
[gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2886
diff
changeset
|
2237 message_queue = g_slist_append(message_queue, qm); |
1066
d6c70d58a4b2
[gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
2238 } |
d6c70d58a4b2
[gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
2239 } |
1661
6cea395b627d
[gaim-migrate @ 1671]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1634
diff
changeset
|
2240 bs->sound = 2; |
1098
b335c0ce305e
[gaim-migrate @ 1108]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1097
diff
changeset
|
2241 } else if (bs->log_timer == 0) { |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2242 if (gc->prpl->list_icon) |
2662
b0c5770156e1
[gaim-migrate @ 2675]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2641
diff
changeset
|
2243 xpm = gc->prpl->list_icon(b->uc); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2244 if (xpm == NULL) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2245 xpm = (char **)no_icon_xpm; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2246 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, NULL, xpm); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2247 gtk_widget_hide(bs->pix); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2248 gtk_pixmap_set(GTK_PIXMAP(bs->pix), pm, bm); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2249 gtk_widget_show(bs->pix); |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2281
diff
changeset
|
2250 if (!(blist_options & OPT_BLIST_SHOW_PIXMAPS)) |
1711
9b86520e04ac
[gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1699
diff
changeset
|
2251 gtk_widget_hide(bs->pix); |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
2252 gdk_pixmap_unref(pm); |
804
17def2bb9720
[gaim-migrate @ 814]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
803
diff
changeset
|
2253 gdk_bitmap_unref(bm); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2254 } |
1058
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
2255 update_idle_time(bs); |
1 | 2256 } else { |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2257 gs = find_group_show(g->name); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2258 if (!gs) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2259 return; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2260 bs = find_buddy_show(gs, b->name); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2261 if (!bs) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2262 return; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2263 if (!bs->connlist) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2264 return; /* we won't do signoff updates for |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2265 buddies that have already signed |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2266 off */ |
1299
18c3874ea051
[gaim-migrate @ 1309]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1297
diff
changeset
|
2267 if (bs->sound != 1) |
3060 | 2268 play_sound(SND_BUDDY_LEAVE); |
3192 | 2269 if (blist_options & OPT_BLIST_POPUP) |
4280 | 2270 gdk_window_show(blist->window); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2271 bs->connlist = g_slist_remove(bs->connlist, gc); |
2778
27c22147e023
[gaim-migrate @ 2791]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2736
diff
changeset
|
2272 update_num_group(gs); |
1032
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
2273 if (bs->log_timer > 0) |
4168 | 2274 g_source_remove(bs->log_timer); |
2275 bs->log_timer = g_timeout_add(10000, log_timeout, bs); | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2276 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, NULL, logout_icon_xpm); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2277 gtk_widget_hide(bs->pix); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2278 gtk_pixmap_set(GTK_PIXMAP(bs->pix), pm, bm); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2279 gtk_widget_show(bs->pix); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2280 gdk_pixmap_unref(pm); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2281 gdk_bitmap_unref(bm); |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2281
diff
changeset
|
2282 if ((bs->sound != 1) && (im_options & OPT_IM_LOGON)) { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
2283 struct gaim_conversation *c = gaim_find_conversation(b->name); |
1066
d6c70d58a4b2
[gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
2284 if (c) { |
d6c70d58a4b2
[gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
2285 char tmp[1024]; |
4227 | 2286 g_snprintf(tmp, sizeof(tmp), _("%s logged out."), |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
2287 get_buddy_alias(b)); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
2288 gaim_conversation_write(c, NULL, tmp, -1, |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
2289 WFLAG_SYSTEM, time(NULL)); |
4412 | 2290 } else if (awayqueue && find_queue_total_by_name(b->name)) { |
2906
538c58b43eff
[gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2886
diff
changeset
|
2291 struct queued_message *qm = g_new0(struct queued_message, 1); |
4227 | 2292 g_snprintf(qm->name, sizeof(qm->name), "%s", |
2293 get_buddy_alias(b)); | |
2294 qm->message = g_strdup_printf(_("%s logged out."), | |
2295 get_buddy_alias(b)); | |
2906
538c58b43eff
[gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2886
diff
changeset
|
2296 qm->gc = gc; |
538c58b43eff
[gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2886
diff
changeset
|
2297 qm->tm = time(NULL); |
538c58b43eff
[gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2886
diff
changeset
|
2298 qm->flags = WFLAG_SYSTEM; |
538c58b43eff
[gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2886
diff
changeset
|
2299 qm->len = -1; |
538c58b43eff
[gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2886
diff
changeset
|
2300 message_queue = g_slist_append(message_queue, qm); |
1066
d6c70d58a4b2
[gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
2301 } |
d6c70d58a4b2
[gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
2302 } |
1661
6cea395b627d
[gaim-migrate @ 1671]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1634
diff
changeset
|
2303 |
6cea395b627d
[gaim-migrate @ 1671]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1634
diff
changeset
|
2304 bs->sound = 1; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2305 } |
1 | 2306 } |
2307 | |
4393
bca8256a91a6
[gaim-migrate @ 4659]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4359
diff
changeset
|
2308 static gboolean configure_blist_window(GtkWidget *w, GdkEventConfigure *event, gpointer data) { |
4108 | 2309 /* unfortunately GdkEventConfigure ignores the window gravity, but * |
2310 * the only way we have of setting the position doesn't. we have to * | |
2311 * call get_position and get_size because they do pay attention to * | |
2312 * the gravity. this is inefficient and I agree it sucks, but it's * | |
2313 * more likely to work correctly. - Robot101 */ | |
4109 | 2314 gint x, y; |
4108 | 2315 |
2316 gtk_window_get_position(GTK_WINDOW(blist), &x, &y); | |
2317 | |
2318 if (x != blist_pos.x || | |
2319 y != blist_pos.y || | |
4109 | 2320 event->width != blist_pos.width || |
2321 event->height != blist_pos.height) { | |
4157 | 2322 blist_pos.x = x; |
2323 blist_pos.y = y; | |
4109 | 2324 blist_pos.width = event->width; |
2325 blist_pos.height = event->height; | |
3540 | 2326 save_prefs(); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2327 } |
4393
bca8256a91a6
[gaim-migrate @ 4659]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4359
diff
changeset
|
2328 return FALSE; |
1 | 2329 } |
2330 | |
3939 | 2331 static void visibility_blist_window(GtkWidget *w, GdkEventVisibility *event, void *data) { |
2332 if (event->state == GDK_VISIBILITY_FULLY_OBSCURED) { | |
2333 obscured = TRUE; | |
2334 } else { | |
2335 obscured = FALSE; | |
3570 | 2336 } |
3554 | 2337 } |
2338 | |
1 | 2339 /******************************************************************* |
2340 * | |
2341 * Helper funs for making the menu | |
2342 * | |
2343 *******************************************************************/ | |
2344 | |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
2345 void gaim_separator(GtkWidget *menu) |
1 | 2346 { |
3878 | 2347 GtkWidget *menuitem; |
2348 | |
2349 menuitem = gtk_separator_menu_item_new(); | |
2350 gtk_widget_show(menuitem); | |
1 | 2351 gtk_menu_append(GTK_MENU(menu), menuitem); |
2352 } | |
2353 | |
2354 | |
696
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2355 void build_imchat_box(gboolean on) |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2356 { |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2357 if (on) { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2358 if (imchatbox) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2359 return; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2360 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2361 imbutton = gtk_button_new_with_label(_("IM")); |
696
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2362 infobutton = gtk_button_new_with_label(_("Info")); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2363 chatbutton = gtk_button_new_with_label(_("Chat")); |
1929
d51ea669d84e
[gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1918
diff
changeset
|
2364 awaybutton = gtk_button_new_with_label(_("Away")); |
696
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2365 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2366 imchatbox = gtk_hbox_new(TRUE, 10); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2367 |
3902 | 2368 gtk_button_set_relief(GTK_BUTTON(imbutton), GTK_RELIEF_NONE); |
2369 gtk_button_set_relief(GTK_BUTTON(infobutton), GTK_RELIEF_NONE); | |
2370 gtk_button_set_relief(GTK_BUTTON(chatbutton), GTK_RELIEF_NONE); | |
2371 gtk_button_set_relief(GTK_BUTTON(awaybutton), GTK_RELIEF_NONE); | |
696
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2372 |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2373 /* Put the buttons in the hbox */ |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2374 gtk_widget_show(imbutton); |
1929
d51ea669d84e
[gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1918
diff
changeset
|
2375 gtk_widget_show(infobutton); |
696
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2376 gtk_widget_show(chatbutton); |
1929
d51ea669d84e
[gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1918
diff
changeset
|
2377 gtk_widget_show(awaybutton); |
696
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2378 |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2379 gtk_box_pack_start(GTK_BOX(imchatbox), imbutton, TRUE, TRUE, 0); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2380 gtk_box_pack_start(GTK_BOX(imchatbox), infobutton, TRUE, TRUE, 0); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2381 gtk_box_pack_start(GTK_BOX(imchatbox), chatbutton, TRUE, TRUE, 0); |
1929
d51ea669d84e
[gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1918
diff
changeset
|
2382 gtk_box_pack_start(GTK_BOX(imchatbox), awaybutton, TRUE, TRUE, 0); |
1172 | 2383 gtk_container_border_width(GTK_CONTAINER(imchatbox), 5); |
696
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2384 |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
2385 g_signal_connect(GTK_OBJECT(imbutton), "clicked", G_CALLBACK(im_callback), |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2386 buddies); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
2387 g_signal_connect(GTK_OBJECT(infobutton), "clicked", G_CALLBACK(info_callback), |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2388 buddies); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
2389 g_signal_connect(GTK_OBJECT(chatbutton), "clicked", G_CALLBACK(chat_callback), |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2390 buddies); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
2391 g_signal_connect(GTK_OBJECT(awaybutton), "clicked", G_CALLBACK(away_callback), |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2392 buddies); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2393 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2394 gtk_tooltips_set_tip(tips, infobutton, _("Information on selected Buddy"), "Penguin"); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2395 gtk_tooltips_set_tip(tips, imbutton, _("Send Instant Message"), "Penguin"); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2396 gtk_tooltips_set_tip(tips, chatbutton, _("Start/join a Buddy Chat"), "Penguin"); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2397 gtk_tooltips_set_tip(tips, awaybutton, _("Activate Away Message"), "Penguin"); |
696
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2398 |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2399 gtk_box_pack_start(GTK_BOX(buddypane), imchatbox, FALSE, FALSE, 0); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2400 |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2401 gtk_widget_show(imchatbox); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2402 } else { |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2403 if (imchatbox) |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2404 gtk_widget_destroy(imchatbox); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2405 imchatbox = NULL; |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2406 } |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2407 } |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2408 |
3204 | 2409 extern GtkWidget *debugbutton; |
2410 void clicked_debug (GtkWidget *widg, gpointer pntr) | |
2411 { | |
2412 if (debugbutton) | |
2413 gtk_button_clicked(GTK_BUTTON(debugbutton)); | |
2414 else { | |
2415 misc_options ^= OPT_MISC_DEBUG; | |
2416 show_debug(); | |
2417 } | |
2418 } | |
1 | 2419 |
3570 | 2420 void make_buddy_list() |
1 | 2421 { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2422 |
1 | 2423 /* Build the buddy list, based on *config */ |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2424 |
1 | 2425 GtkWidget *sw; |
2426 GtkWidget *menu; | |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
2427 #ifdef NO_MULTI |
1 | 2428 GtkWidget *setmenu; |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
2429 GtkWidget *findmenu; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
2430 #endif |
1 | 2431 GtkWidget *menubar; |
2432 GtkWidget *vbox; | |
2433 GtkWidget *menuitem; | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2434 GtkWidget *notebook; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2435 GtkWidget *label; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2436 GtkWidget *bbox; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2437 GtkWidget *tbox; |
1 | 2438 |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
945
diff
changeset
|
2439 if (blist) { |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
945
diff
changeset
|
2440 return; |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
945
diff
changeset
|
2441 } |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
945
diff
changeset
|
2442 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2443 blist = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2444 |
4167 | 2445 gtk_window_set_gravity(GTK_WINDOW(blist), GDK_GRAVITY_NORTH_WEST); |
3570 | 2446 gtk_window_set_policy(GTK_WINDOW(blist), TRUE, TRUE, TRUE); |
2447 gtk_window_set_title(GTK_WINDOW(blist), _("Gaim - Buddy List")); | |
4074 | 2448 gtk_window_set_role(GTK_WINDOW(blist), "buddy_list"); |
905 | 2449 |
1 | 2450 gtk_widget_realize(blist); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2451 |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2452 accel = gtk_accel_group_new(); |
3570 | 2453 gtk_window_add_accel_group(GTK_WINDOW(blist), accel); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2454 |
1 | 2455 menubar = gtk_menu_bar_new(); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2456 |
1 | 2457 menu = gtk_menu_new(); |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2458 gtk_menu_set_accel_group(GTK_MENU(menu), accel); |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2459 |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2460 menuitem = gaim_new_item(NULL, _("File")); |
1 | 2461 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu); |
2462 gtk_menu_bar_append(GTK_MENU_BAR(menubar), menuitem); | |
2463 | |
3879 | 2464 gaim_new_item_from_stock(menu, _("_Add A Buddy"), GTK_STOCK_ADD, |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
2465 G_CALLBACK(add_buddy_callback), NULL, 'b', GDK_CONTROL_MASK, "Ctl+B"); |
3879 | 2466 gaim_new_item_from_stock(menu, _("_Join A Chat"), GTK_STOCK_JUMP_TO, |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
2467 G_CALLBACK(chat_callback), NULL, 'c', GDK_CONTROL_MASK, "Ctl+C"); |
3879 | 2468 gaim_new_item_from_stock(menu, _("_New Message"), GTK_STOCK_CONVERT, |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
2469 G_CALLBACK(show_im_dialog), NULL, 'i', GDK_CONTROL_MASK, "Ctl+I"); |
3879 | 2470 gaim_new_item_from_stock(menu, _("_Get User Info"), GTK_STOCK_FIND, |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
2471 G_CALLBACK(show_info_dialog), NULL, 'j', GDK_CONTROL_MASK, "Ctl+J"); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2472 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2473 gaim_separator(menu); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2474 |
3881 | 2475 gaim_new_item_from_pixbuf(menu, _("Import Buddy List"), "import-menu.png", |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
2476 G_CALLBACK(import_callback), NULL, 0, 0, 0); |
3570 | 2477 |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
2478 gaim_separator(menu); |
3570 | 2479 |
3872 | 2480 gaim_new_item_from_stock(menu, _("Signoff"), NULL, |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
2481 G_CALLBACK(signoff_all), (void*)1, 'd', GDK_CONTROL_MASK, "Ctl+D"); |
3872 | 2482 gaim_new_item_from_stock(menu, _("Hide"), NULL, |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
2483 G_CALLBACK(hide_buddy_list), NULL, 'h', GDK_CONTROL_MASK, "Ctl+H"); |
3872 | 2484 gaim_new_item_from_stock(menu, _("Quit"), GTK_STOCK_QUIT, |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
2485 G_CALLBACK(do_quit), NULL, 'q', GDK_CONTROL_MASK, "Ctl+Q"); |
1 | 2486 |
2487 menu = gtk_menu_new(); | |
2488 | |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2489 menuitem = gaim_new_item(NULL, _("Tools")); |
1 | 2490 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu); |
2491 gtk_menu_bar_append(GTK_MENU_BAR(menubar), menuitem); | |
2492 | |
2493 awaymenu = gtk_menu_new(); | |
3876 | 2494 menuitem = gaim_new_item_from_stock(menu, _("Away"), NULL, NULL, NULL, 0, 0, 0); |
1 | 2495 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), awaymenu); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2496 do_away_menu(); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2497 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2498 bpmenu = gtk_menu_new(); |
3876 | 2499 menuitem = gaim_new_item_from_stock(menu, _("Buddy Pounce"), NULL, NULL, NULL, 0, 0, 0); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2500 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), bpmenu); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2501 do_bp_menu(); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2502 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2503 gaim_separator(menu); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
2504 |
2598
b2800bca74fe
[gaim-migrate @ 2611]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2592
diff
changeset
|
2505 #ifndef NO_MULTI |
3883 | 2506 gaim_new_item_from_pixbuf(menu, _("_Accounts..."), "accounts-menu.png", |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
2507 G_CALLBACK(account_editor), NULL, 'a', GDK_CONTROL_MASK, "Ctl+A"); |
2598
b2800bca74fe
[gaim-migrate @ 2611]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2592
diff
changeset
|
2508 #endif |
3879 | 2509 gaim_new_item_from_stock(menu, _("_Preferences..."), GTK_STOCK_PREFERENCES, |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
2510 G_CALLBACK(show_prefs), NULL, 'p', GDK_CONTROL_MASK, "Ctl+P"); |
3877 | 2511 |
2512 gaim_separator(menu); | |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
2513 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
2514 protomenu = gtk_menu_new(); |
3876 | 2515 menuitem = gaim_new_item_from_stock(menu, _("Protocol Actions"), NULL, NULL, NULL, 0, 0, 0); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
2516 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), protomenu); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
2517 do_proto_menu(); |
1 | 2518 |
3879 | 2519 gaim_new_item_from_stock(menu, _("Pr_ivacy..."), NULL, |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
2520 G_CALLBACK(show_privacy_options), NULL, 0, 0, 0); |
3877 | 2521 |
3879 | 2522 gaim_new_item_from_stock(menu, _("_View System Log..."), NULL, |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
2523 G_CALLBACK(show_syslog), NULL, 0, 0, 0); |
90
f5b305c0d974
[gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
87
diff
changeset
|
2524 |
1 | 2525 menu = gtk_menu_new(); |
2526 | |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2527 menuitem = gaim_new_item(NULL, _("Help")); |
1 | 2528 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu); |
2529 gtk_menu_bar_append(GTK_MENU_BAR(menubar), menuitem); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2530 |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
2531 gaim_new_item_from_stock(menu, _("Online Help"), GTK_STOCK_HELP, G_CALLBACK(open_url), WEBSITE"documentation.php", GDK_F1, 0, NULL); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
2532 gaim_new_item_from_stock(menu, _("Debug Window"), NULL, G_CALLBACK(clicked_debug), NULL, 0, 0, NULL); |
3882 | 2533 |
2534 gaim_separator(menu); | |
2535 | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
2536 gaim_new_item_from_pixbuf(menu, _("About Gaim"), "about_menu.png", G_CALLBACK(show_about), NULL, GDK_F1, GDK_CONTROL_MASK, NULL); |
3204 | 2537 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2538 gtk_widget_show(menubar); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2539 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2540 vbox = gtk_vbox_new(FALSE, 0); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2541 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2542 notebook = gtk_notebook_new(); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2543 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2544 /* Do buddy list stuff */ |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2545 /* FIXME: spacing on both panes is ad hoc */ |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2546 buddypane = gtk_vbox_new(FALSE, 1); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2547 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2548 buddies = gtk_tree_new(); |
3131 | 2549 gtk_tree_set_view_lines(GTK_TREE(buddies), FALSE); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2550 sw = gtk_scrolled_window_new(NULL, NULL); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2551 |
1 | 2552 tips = gtk_tooltips_new(); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2553 gtk_object_set_data(GTK_OBJECT(blist), _("Buddy List"), tips); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2554 |
1 | 2555 /* Now the buddy list */ |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2556 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), buddies); |
1 | 2557 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2558 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2559 gtk_widget_set_usize(sw, 200, 200); |
1 | 2560 gtk_widget_show(buddies); |
2561 gtk_widget_show(sw); | |
2562 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2563 gtk_box_pack_start(GTK_BOX(buddypane), sw, TRUE, TRUE, 0); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2564 gtk_widget_show(buddypane); |
1 | 2565 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2281
diff
changeset
|
2566 if (!(blist_options & OPT_BLIST_NO_BUTTONS)) |
696
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2567 build_imchat_box(TRUE); |
1 | 2568 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2569 /* Swing the edit buddy */ |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2570 editpane = gtk_vbox_new(FALSE, 1); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2571 |
1 | 2572 edittree = gtk_ctree_new(1, 0); |
3152 | 2573 gtk_ctree_set_line_style(GTK_CTREE(edittree), GTK_CTREE_LINES_SOLID);; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2574 gtk_ctree_set_expander_style(GTK_CTREE(edittree), GTK_CTREE_EXPANDER_SQUARE); |
1 | 2575 gtk_clist_set_reorderable(GTK_CLIST(edittree), TRUE); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
2576 g_signal_connect(GTK_OBJECT(edittree), "button_press_event", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
2577 G_CALLBACK(click_edit_tree), NULL); |
1 | 2578 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2579 gtk_ctree_set_drag_compare_func(GTK_CTREE(edittree), |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2580 (GtkCTreeCompareDragFunc) edit_drag_compare_func); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2581 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2582 |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
2583 g_signal_connect_after(GTK_OBJECT(edittree), "tree_move", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
2584 G_CALLBACK(edit_tree_move), NULL); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2585 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2586 |
1172 | 2587 bbox = gtk_hbox_new(TRUE, 5); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2588 gtk_container_set_border_width(GTK_CONTAINER(bbox), 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2589 tbox = gtk_scrolled_window_new(NULL, NULL); |
3570 | 2590 |
2591 /* buttons */ | |
2592 addbutton = gtk_button_new_with_label(_("Add")); | |
2593 groupbutton = gtk_button_new_with_label(_("Group")); | |
2594 rembutton = gtk_button_new_with_label(_("Remove")); | |
2595 | |
3902 | 2596 gtk_button_set_relief(GTK_BUTTON(addbutton), GTK_RELIEF_NONE); |
2597 gtk_button_set_relief(GTK_BUTTON(groupbutton), GTK_RELIEF_NONE); | |
2598 gtk_button_set_relief(GTK_BUTTON(rembutton), GTK_RELIEF_NONE); | |
3570 | 2599 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2600 gtk_box_pack_start(GTK_BOX(bbox), addbutton, TRUE, TRUE, 0); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2601 gtk_box_pack_start(GTK_BOX(bbox), groupbutton, TRUE, TRUE, 0); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2602 gtk_box_pack_start(GTK_BOX(bbox), rembutton, TRUE, TRUE, 0); |
1 | 2603 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2604 gtk_tooltips_set_tip(tips, addbutton, _("Add a new Buddy"), "Penguin"); |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
2605 gtk_tooltips_set_tip(tips, groupbutton, _("Add a new Group"), "Penguin"); |
2134
6641141234b7
[gaim-migrate @ 2144]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2132
diff
changeset
|
2606 gtk_tooltips_set_tip(tips, rembutton, _("Remove selected Buddy/Group"), "Penguin"); |
1 | 2607 |
3570 | 2608 g_signal_connect(G_OBJECT(rembutton), "clicked", G_CALLBACK(do_del_buddy), edittree); |
2609 g_signal_connect(G_OBJECT(addbutton), "clicked", G_CALLBACK(add_buddy_callback), NULL); | |
2610 g_signal_connect(G_OBJECT(groupbutton), "clicked", G_CALLBACK(add_group_callback), NULL); | |
2611 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2612 /* And the boxes in the box */ |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2613 gtk_box_pack_start(GTK_BOX(editpane), tbox, TRUE, TRUE, 0); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2614 gtk_box_pack_start(GTK_BOX(editpane), bbox, FALSE, FALSE, 0); |
1 | 2615 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2616 /* Finish up */ |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2617 gtk_widget_show(addbutton); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2618 gtk_widget_show(groupbutton); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2619 gtk_widget_show(rembutton); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2620 gtk_widget_show(edittree); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2621 gtk_widget_show(tbox); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2622 gtk_widget_show(bbox); |
1 | 2623 gtk_widget_show(editpane); |
2624 | |
703
20553b584ccb
[gaim-migrate @ 713]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
700
diff
changeset
|
2625 update_button_pix(); |
20553b584ccb
[gaim-migrate @ 713]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
700
diff
changeset
|
2626 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2627 label = gtk_label_new(_("Online")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2628 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), buddypane, label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2629 label = gtk_label_new(_("Edit Buddies")); |
1 | 2630 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), editpane, label); |
2631 | |
3032 | 2632 if(blist_options & OPT_BLIST_BOTTOM_TAB) |
2633 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_BOTTOM); | |
2634 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2635 gtk_widget_show_all(notebook); |
1 | 2636 |
2637 /* Pack things in the vbox */ | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2638 gtk_widget_show(vbox); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2639 gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0); |
1 | 2640 gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2641 gtk_container_add(GTK_CONTAINER(blist), vbox); |
1 | 2642 |
3570 | 2643 g_signal_connect(G_OBJECT(blist), "delete_event", G_CALLBACK(close_buddy_list), NULL); |
2644 g_signal_connect(G_OBJECT(blist), "configure_event", G_CALLBACK(configure_blist_window), NULL); | |
3939 | 2645 g_signal_connect(G_OBJECT(blist), "visibility_notify_event", G_CALLBACK(visibility_blist_window), NULL); |
2646 | |
2647 gtk_widget_add_events(blist, GDK_VISIBILITY_NOTIFY_MASK); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2648 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2649 /* The edit tree */ |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2650 gtk_container_add(GTK_CONTAINER(tbox), edittree); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2651 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(tbox), |
3558 | 2652 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
3630 | 2653 |
2654 #ifdef _WIN32 | |
3948
40258b6b5ecf
[gaim-migrate @ 4127]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3939
diff
changeset
|
2655 /* Register newly created window with systray module */ |
40258b6b5ecf
[gaim-migrate @ 4127]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3939
diff
changeset
|
2656 wgaim_created_blistwin(GTK_WIDGET(blist)); |
3630 | 2657 #endif |
4239 | 2658 |
2659 /* Houston, we are go for launch. */ | |
2660 unhide_buddy_list(); | |
1 | 2661 } |
2662 | |
3570 | 2663 void show_buddy_list() |
1 | 2664 { |
3570 | 2665 make_buddy_list(); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2666 build_edit_tree(); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2667 update_button_pix(); |
1 | 2668 } |