Mercurial > pidgin
annotate src/buddy.c @ 870:9b8b83592bb6
[gaim-migrate @ 880]
Here's a story, of a man named Brady ..
committer: Tailor Script <tailor@pidgin.im>
author | Rob Flynn <gaim@robflynn.com> |
---|---|
date | Sun, 10 Sep 2000 21:38:38 +0000 |
parents | 789b2f0bb133 |
children | 0532f6f85fac |
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 |
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
342
diff
changeset
|
23 #include "../config.h" |
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
342
diff
changeset
|
24 #endif |
1 | 25 #ifdef USE_APPLET |
26 #include <gnome.h> | |
27 #include <applet-widget.h> | |
84 | 28 #include "gnome_applet_mgr.h" |
1 | 29 #endif /* USE_APPLET */ |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
30 #ifdef GAIM_PLUGINS |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
31 #include <dlfcn.h> |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
32 #endif /* GAIM_PLUGINS */ |
1 | 33 #include <string.h> |
34 #include <stdio.h> | |
35 #include <stdlib.h> | |
36 #include <math.h> | |
37 #include <time.h> | |
38 | |
39 #include <gtk/gtk.h> | |
40 #include <gdk/gdkx.h> | |
41 #include "gaim.h" | |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
42 #include <aim.h> |
1 | 43 #include "pixmaps/admin_icon.xpm" |
44 #include "pixmaps/aol_icon.xpm" | |
45 #include "pixmaps/free_icon.xpm" | |
46 #include "pixmaps/dt_icon.xpm" | |
47 #include "pixmaps/no_icon.xpm" | |
48 #include "pixmaps/login_icon.xpm" | |
49 #include "pixmaps/logout_icon.xpm" | |
50 | |
51 #include "pixmaps/buddyadd.xpm" | |
52 #include "pixmaps/buddydel.xpm" | |
53 #include "pixmaps/buddychat.xpm" | |
54 #include "pixmaps/im.xpm" | |
55 #include "pixmaps/info.xpm" | |
56 #include "pixmaps/away_icon.xpm" | |
57 | |
150
d4e99c17e399
[gaim-migrate @ 160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
146
diff
changeset
|
58 #include "pixmaps/daemon-buddyadd.xpm" |
d4e99c17e399
[gaim-migrate @ 160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
146
diff
changeset
|
59 #include "pixmaps/daemon-buddydel.xpm" |
d4e99c17e399
[gaim-migrate @ 160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
146
diff
changeset
|
60 #include "pixmaps/daemon-buddychat.xpm" |
d4e99c17e399
[gaim-migrate @ 160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
146
diff
changeset
|
61 #include "pixmaps/daemon-im.xpm" |
d4e99c17e399
[gaim-migrate @ 160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
146
diff
changeset
|
62 #include "pixmaps/daemon-info.xpm" |
d4e99c17e399
[gaim-migrate @ 160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
146
diff
changeset
|
63 |
714 | 64 #include "pixmaps/add_small.xpm" |
718 | 65 #include "pixmaps/import_small.xpm" |
733 | 66 #include "pixmaps/export_small.xpm" |
801 | 67 #ifdef GAIM_PLUGINS |
68 #include "pixmaps/plugins_small.xpm" | |
69 #endif | |
70 #include "pixmaps/prefs_small.xpm" | |
71 #include "pixmaps/search_small.xpm" | |
747
eec93c5929b9
[gaim-migrate @ 757]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
746
diff
changeset
|
72 #ifdef USE_APPLET |
727 | 73 #include "pixmaps/close_small.xpm" |
747
eec93c5929b9
[gaim-migrate @ 757]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
746
diff
changeset
|
74 #endif |
727 | 75 #include "pixmaps/exit_small.xpm" |
865 | 76 #include "pixmaps/pounce_small.xpm" |
714 | 77 |
820 | 78 #include "pixmaps/tmp_send.xpm" |
79 #include "pixmaps/tb_search.xpm" | |
870 | 80 #include "pixmaps/join.xpm" |
820 | 81 |
1 | 82 static GtkTooltips *tips; |
83 static GtkWidget *editpane; | |
84 static GtkWidget *buddypane; | |
696
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
85 static GtkWidget *imchatbox; |
1 | 86 static GtkWidget *edittree; |
87 static GtkWidget *imbutton, *infobutton, *chatbutton; | |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
88 static GtkWidget *addbutton, *groupbutton, *rembutton; |
1 | 89 |
436 | 90 extern int ticker_prefs; |
1 | 91 |
92 GtkWidget *blist = NULL; | |
93 GtkWidget *bpmenu; | |
94 GtkWidget *buddies; | |
95 int permdeny; | |
96 | |
430 | 97 void BuddyTickerLogonTimeout( gpointer data ); |
98 void BuddyTickerLogoutTimeout( gpointer data ); | |
1 | 99 |
100 /* Predefine some functions */ | |
101 static void new_bp_callback(GtkWidget *w, char *name); | |
102 static void log_callback(GtkWidget *w, char *name); | |
103 | |
104 | |
105 void destroy_buddy() | |
106 { | |
107 if (blist) | |
108 gtk_widget_destroy(blist); | |
109 blist=NULL; | |
700
d904bf694bd7
[gaim-migrate @ 710]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
696
diff
changeset
|
110 imchatbox = NULL; |
1 | 111 } |
112 | |
113 void update_num_groups() | |
114 { | |
115 GList *grp = groups; | |
116 GList *mem; | |
117 struct buddy *b; | |
118 struct group *g; | |
119 int pres, total; | |
120 char buf[BUF_LONG]; | |
121 | |
342
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
122 #ifndef USE_APPLET |
1 | 123 if (!(display_options & OPT_DISP_SHOW_GRPNUM)) |
124 return; | |
342
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
125 #else |
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
126 int onl = 0; |
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
127 int all = 0; |
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
128 #endif |
1 | 129 |
130 while(grp) { | |
131 g = (struct group *)grp->data; | |
132 mem = g->members; | |
133 pres = 0; | |
134 total = 0; | |
135 while(mem) { | |
136 b = (struct buddy *)mem->data; | |
137 if (b->present) | |
138 pres++; | |
139 total++; | |
140 | |
141 | |
142 mem = mem->next; | |
143 } | |
144 | |
145 g_snprintf(buf, sizeof(buf), "%s (%d/%d)", g->name, pres, total); | |
146 | |
342
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
147 #ifdef USE_APPLET |
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
148 onl += pres; |
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
149 all += total; |
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
150 if (display_options & OPT_DISP_SHOW_GRPNUM) |
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
151 #endif |
1 | 152 gtk_label_set(GTK_LABEL(g->label), buf); |
153 grp = grp->next; | |
154 } | |
342
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
155 #ifdef USE_APPLET |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
156 g_snprintf(buf, sizeof(buf), _("%d/%d Buddies Online"), onl, all); |
342
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
157 applet_set_tooltips(buf); |
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
158 #endif |
1 | 159 } |
160 | |
161 void update_show_idlepix() | |
162 { | |
163 GList *grp = groups; | |
164 GList *mem; | |
165 struct group *g; | |
166 struct buddy *b; | |
167 | |
168 while (grp) { | |
169 g = (struct group *)grp->data; | |
170 mem = g->members; | |
171 | |
172 while(mem) { | |
173 b = (struct buddy *)mem->data; | |
174 | |
175 if (display_options & OPT_DISP_SHOW_IDLETIME) | |
176 gtk_widget_show(b->idletime); | |
177 else | |
178 gtk_widget_hide(b->idletime); | |
179 | |
180 if (display_options & OPT_DISP_SHOW_PIXMAPS) | |
181 gtk_widget_show(b->pix); | |
182 else | |
183 gtk_widget_hide(b->pix); | |
184 mem = mem->next; | |
185 } | |
186 grp = grp->next; | |
187 } | |
188 } | |
189 | |
190 void update_all_buddies() | |
191 { | |
192 GList *grp = groups; | |
193 GList *mem; | |
194 struct buddy *b; | |
195 struct group *g; | |
196 | |
197 while(grp) { | |
198 g = (struct group *)grp->data; | |
199 mem = g->members; | |
200 while(mem) { | |
201 b = (struct buddy *)mem->data; | |
202 | |
59 | 203 if (b->present || !GTK_WIDGET_VISIBLE(b->item)) |
204 set_buddy(b); | |
1 | 205 |
206 mem = mem->next; | |
207 } | |
208 grp = grp->next; | |
209 } | |
210 | |
211 | |
212 } | |
213 | |
214 static void adjust_pic(GtkWidget *button, const char *c, gchar **xpm) | |
215 { | |
216 GdkPixmap *pm; | |
217 GdkBitmap *bm; | |
218 GtkWidget *pic; | |
219 GtkWidget *label; | |
220 | |
221 /*if the user had opted to put pictures on the buttons*/ | |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
222 if (display_options & OPT_DISP_SHOW_BUTTON_XPM && xpm) { |
820 | 223 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, NULL, xpm); |
1 | 224 pic = gtk_pixmap_new(pm, bm); |
225 gtk_widget_show(pic); | |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
226 gdk_pixmap_unref(pm); |
804
17def2bb9720
[gaim-migrate @ 814]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
803
diff
changeset
|
227 gdk_bitmap_unref(bm); |
1 | 228 label = GTK_BIN(button)->child; |
229 gtk_container_remove(GTK_CONTAINER(button), label); | |
230 gtk_container_add(GTK_CONTAINER(button), pic); | |
231 } else { | |
232 label = gtk_label_new(c); | |
233 gtk_widget_show(label); | |
234 pic = GTK_BIN(button)->child; | |
235 gtk_container_remove(GTK_CONTAINER(button), pic); | |
236 gtk_container_add(GTK_CONTAINER(button), label); | |
237 } | |
238 | |
239 } | |
240 | |
241 | |
242 void update_button_pix() | |
243 { | |
244 | |
824
4886f52e04c3
[gaim-migrate @ 834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
820
diff
changeset
|
245 if (display_options & OPT_DISP_DEVIL_PIXMAPS) { |
4886f52e04c3
[gaim-migrate @ 834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
820
diff
changeset
|
246 adjust_pic(addbutton, _("Add"), (gchar **)daemon_buddyadd_xpm); |
4886f52e04c3
[gaim-migrate @ 834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
820
diff
changeset
|
247 adjust_pic(groupbutton, _("Group"), NULL); |
4886f52e04c3
[gaim-migrate @ 834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
820
diff
changeset
|
248 adjust_pic(rembutton, _("Remove"), (gchar **)daemon_buddydel_xpm); |
4886f52e04c3
[gaim-migrate @ 834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
820
diff
changeset
|
249 } else { |
4886f52e04c3
[gaim-migrate @ 834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
820
diff
changeset
|
250 adjust_pic(addbutton, _("Add"), (gchar **)buddyadd_xpm); |
4886f52e04c3
[gaim-migrate @ 834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
820
diff
changeset
|
251 adjust_pic(groupbutton, _("Group"), NULL); |
4886f52e04c3
[gaim-migrate @ 834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
820
diff
changeset
|
252 adjust_pic(rembutton, _("Remove"), (gchar **)buddydel_xpm); |
4886f52e04c3
[gaim-migrate @ 834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
820
diff
changeset
|
253 } |
820 | 254 if (!(display_options & OPT_DISP_NO_BUTTONS)) { |
870 | 255 adjust_pic(chatbutton, _("Chat"), (gchar **)join_xpm); |
820 | 256 adjust_pic(imbutton, _("IM"), (gchar **)tmp_send_xpm); |
257 adjust_pic(infobutton, _("Info"), (gchar **)tb_search_xpm); | |
258 } | |
544
53a85529d670
[gaim-migrate @ 554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
259 gtk_widget_hide(addbutton->parent); |
53a85529d670
[gaim-migrate @ 554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
260 gtk_widget_show(addbutton->parent); |
696
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
261 if (!(display_options & OPT_DISP_NO_BUTTONS)) { |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
262 gtk_widget_hide(chatbutton->parent); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
263 gtk_widget_show(chatbutton->parent); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
264 } |
820 | 265 } |
1 | 266 |
267 | |
268 | |
269 #ifdef USE_APPLET | |
270 gint applet_destroy_buddy( GtkWidget *widget, GdkEvent *event,gpointer *data ) { | |
746
5a908dd5cfc4
[gaim-migrate @ 756]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
733
diff
changeset
|
271 applet_buddy_show = FALSE; |
5a908dd5cfc4
[gaim-migrate @ 756]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
733
diff
changeset
|
272 gtk_widget_hide(blist); |
1 | 273 return (TRUE); |
274 } | |
275 | |
276 #endif | |
277 | |
278 | |
279 void signoff() | |
280 { | |
281 GList *mem; | |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
282 |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
774
diff
changeset
|
283 plugin_event(event_signoff, 0, 0, 0); |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
284 |
1 | 285 while(groups) { |
286 mem = ((struct group *)groups->data)->members; | |
287 while(mem) { | |
288 g_free(mem->data); | |
289 mem = g_list_remove(mem, mem->data); | |
290 } | |
291 g_free(groups->data); | |
292 groups = g_list_remove(groups, groups->data); | |
293 } | |
294 | |
813
d06bed40a86b
[gaim-migrate @ 823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
804
diff
changeset
|
295 sprintf(debug_buff, "date: %s\n", full_date()); |
d06bed40a86b
[gaim-migrate @ 823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
804
diff
changeset
|
296 debug_print(debug_buff); |
1 | 297 serv_close(); |
298 destroy_all_dialogs(); | |
299 destroy_buddy(); | |
300 hide_login_progress(""); | |
301 #ifdef USE_APPLET | |
746
5a908dd5cfc4
[gaim-migrate @ 756]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
733
diff
changeset
|
302 set_user_state(offline); |
5a908dd5cfc4
[gaim-migrate @ 756]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
733
diff
changeset
|
303 applet_buddy_show = FALSE; |
1 | 304 applet_widget_unregister_callback(APPLET_WIDGET(applet),"signoff"); |
18 | 305 remove_applet_away(); |
1 | 306 applet_widget_register_callback(APPLET_WIDGET(applet), |
307 "signon", | |
308 _("Signon"), | |
342
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
309 applet_do_signon, |
1 | 310 NULL); |
311 #else | |
312 show_login(); | |
313 #endif /* USE_APPLET */ | |
436 | 314 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
315 BuddyTickerSignoff(); | |
1 | 316 } |
317 | |
318 void handle_click_group(GtkWidget *widget, GdkEventButton *event, gpointer func_data) | |
319 { | |
320 if (event->type == GDK_2BUTTON_PRESS) { | |
321 if (GTK_TREE_ITEM(widget)->expanded) | |
322 gtk_tree_item_collapse(GTK_TREE_ITEM(widget)); | |
323 else | |
324 gtk_tree_item_expand(GTK_TREE_ITEM(widget)); | |
325 } else { | |
326 } | |
327 } | |
328 | |
329 void pressed_im(GtkWidget *widget, struct buddy *b) | |
330 { | |
331 struct conversation *c; | |
332 | |
333 c = find_conversation(b->name); | |
334 | |
335 if (c != NULL) { | |
87 | 336 gdk_window_show(c->window->window); |
1 | 337 } else { |
338 c = new_conversation(b->name); | |
339 } | |
340 } | |
341 | |
438 | 342 void pressed_ticker(char *buddy) |
343 { | |
344 struct conversation *c; | |
345 | |
346 c = find_conversation(buddy); | |
347 | |
348 if (c != NULL) { | |
349 gdk_window_show(c->window->window); | |
350 } else { | |
351 c = new_conversation(buddy); | |
352 } | |
353 } | |
354 | |
1 | 355 void pressed_info(GtkWidget *widget, struct buddy *b) |
356 { | |
357 serv_get_info(b->name); | |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
358 } |
1 | 359 |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
360 void pressed_alias(GtkWidget *widget, struct buddy *b) |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
361 { |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
362 alias_dialog(b); |
1 | 363 } |
364 | |
365 void pressed_dir_info(GtkWidget *widget, struct buddy *b) | |
366 { | |
367 serv_get_dir(b->name); | |
368 | |
369 } | |
370 | |
249
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
371 void pressed_away_msg(GtkWidget *widget, struct buddy *b) |
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
372 { |
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
373 serv_get_away_msg(b->name); |
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
374 |
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
375 } |
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
376 |
1 | 377 void handle_click_buddy(GtkWidget *widget, GdkEventButton *event, struct buddy *b) |
378 { | |
379 if (event->type == GDK_2BUTTON_PRESS && event->button == 1) { | |
380 struct conversation *c; | |
381 | |
382 c = find_conversation(b->name); | |
383 | |
384 if (c != NULL) { | |
87 | 385 gdk_window_show(c->window->window); |
1 | 386 } else { |
387 c = new_conversation(b->name); | |
388 } | |
389 } else if (event->type == GDK_BUTTON_PRESS && event->button == 3) { | |
390 GtkWidget *menu, *button; | |
391 /* We're gonna make us a menu right here */ | |
392 | |
393 menu = gtk_menu_new(); | |
394 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
395 button = gtk_menu_item_new_with_label(_("IM")); |
1 | 396 gtk_signal_connect(GTK_OBJECT(button), "activate", |
397 GTK_SIGNAL_FUNC(pressed_im), b); | |
398 gtk_menu_append(GTK_MENU(menu), button); | |
399 gtk_widget_show(button); | |
400 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
401 button = gtk_menu_item_new_with_label(_("Info")); |
1 | 402 gtk_signal_connect(GTK_OBJECT(button), "activate", |
403 GTK_SIGNAL_FUNC(pressed_info), b); | |
404 gtk_menu_append(GTK_MENU(menu), button); | |
405 gtk_widget_show(button); | |
406 | |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
407 button = gtk_menu_item_new_with_label(_("Alias")); |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
408 gtk_signal_connect(GTK_OBJECT(button), "activate", |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
409 GTK_SIGNAL_FUNC(pressed_alias), b); |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
410 gtk_menu_append(GTK_MENU(menu), button); |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
411 gtk_widget_show(button); |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
412 |
760
d2eef8a40a77
[gaim-migrate @ 770]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
747
diff
changeset
|
413 if (!USE_OSCAR) { |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
414 button = gtk_menu_item_new_with_label(_("Dir Info")); |
1 | 415 gtk_signal_connect(GTK_OBJECT(button), "activate", |
416 GTK_SIGNAL_FUNC(pressed_dir_info), b); | |
417 gtk_menu_append(GTK_MENU(menu), button); | |
418 gtk_widget_show(button); | |
760
d2eef8a40a77
[gaim-migrate @ 770]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
747
diff
changeset
|
419 } else { |
1 | 420 |
515
b33ed0a7f49b
[gaim-migrate @ 525]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
514
diff
changeset
|
421 button = gtk_menu_item_new_with_label(_("Direct IM")); |
b33ed0a7f49b
[gaim-migrate @ 525]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
514
diff
changeset
|
422 gtk_signal_connect(GTK_OBJECT(button), "activate", |
b33ed0a7f49b
[gaim-migrate @ 525]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
514
diff
changeset
|
423 GTK_SIGNAL_FUNC(serv_do_imimage), b->name); |
b33ed0a7f49b
[gaim-migrate @ 525]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
514
diff
changeset
|
424 gtk_menu_append(GTK_MENU(menu), button); |
b33ed0a7f49b
[gaim-migrate @ 525]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
514
diff
changeset
|
425 gtk_widget_show(button); |
b33ed0a7f49b
[gaim-migrate @ 525]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
514
diff
changeset
|
426 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
427 button = gtk_menu_item_new_with_label(_("Away Msg")); |
249
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
428 gtk_signal_connect(GTK_OBJECT(button), "activate", |
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
429 GTK_SIGNAL_FUNC(pressed_away_msg), b); |
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
430 gtk_menu_append(GTK_MENU(menu), button); |
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
431 gtk_widget_show(button); |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
432 } |
249
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
433 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
434 button = gtk_menu_item_new_with_label(_("Toggle Logging")); |
1 | 435 gtk_signal_connect(GTK_OBJECT(button), "activate", |
436 GTK_SIGNAL_FUNC(log_callback), b->name); | |
437 gtk_menu_append(GTK_MENU(menu), button); | |
438 gtk_widget_show(button); | |
439 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
440 button = gtk_menu_item_new_with_label(_("Add Buddy Pounce")); |
1 | 441 gtk_signal_connect(GTK_OBJECT(button), "activate", |
442 GTK_SIGNAL_FUNC(new_bp_callback), b->name); | |
443 gtk_menu_append(GTK_MENU(menu), button); | |
444 gtk_widget_show(button); | |
445 | |
446 | |
447 | |
448 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, | |
449 event->button, event->time); | |
450 | |
451 } else if (event->type == GDK_3BUTTON_PRESS && event->button == 2) { | |
452 if (!strcasecmp("zilding", normalize(b->name))) | |
453 show_ee_dialog(0); | |
454 else if (!strcasecmp("robflynn", normalize(b->name))) | |
455 show_ee_dialog(1); | |
456 else if (!strcasecmp("flynorange", normalize(b->name))) | |
457 show_ee_dialog(2); | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
318
diff
changeset
|
458 else if (!strcasecmp("ewarmenhoven", normalize(b->name))) |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
318
diff
changeset
|
459 show_ee_dialog(3); |
1 | 460 |
461 } else { | |
462 | |
463 /* Anything for other buttons? :) */ | |
464 } | |
465 } | |
466 | |
467 | |
468 | |
469 void remove_buddy(struct group *rem_g, struct buddy *rem_b) | |
470 { | |
471 GList *grp; | |
472 GList *mem; | |
473 | |
474 struct group *delg; | |
475 struct buddy *delb; | |
476 | |
477 grp = g_list_find(groups, rem_g); | |
478 delg = (struct group *)grp->data; | |
479 mem = delg->members; | |
480 | |
481 mem = g_list_find(mem, rem_b); | |
482 delb = (struct buddy *)mem->data; | |
483 | |
484 gtk_tree_remove_items(GTK_TREE(delg->tree), g_list_append(NULL, delb->item)); | |
485 delg->members = g_list_remove(delg->members, delb); | |
486 serv_remove_buddy(delb->name); | |
487 g_free(delb); | |
488 | |
489 serv_save_config(); | |
228 | 490 |
491 // flush buddy list to cache | |
492 | |
493 do_export( (GtkWidget *) NULL, 0 ); | |
1 | 494 |
495 update_num_groups(); | |
496 | |
497 | |
498 } | |
499 | |
500 void remove_group(struct group *rem_g) | |
501 { | |
502 GList *grp; | |
503 GList *mem; | |
504 | |
505 struct group *delg; | |
506 struct buddy *delb; | |
507 | |
508 grp = g_list_find(groups, rem_g); | |
509 delg = (struct group *)grp->data; | |
510 mem = delg->members; | |
511 | |
512 while(delg->members) { | |
513 delb = (struct buddy *)delg->members->data; | |
514 gtk_tree_remove_items(GTK_TREE(delg->tree), g_list_append(NULL, delb->item)); | |
515 delg->members = g_list_remove(delg->members, delb); | |
516 serv_remove_buddy(delb->name); | |
517 g_free(delb); | |
518 } | |
519 | |
520 | |
521 gtk_tree_remove_items(GTK_TREE(buddies), g_list_append(NULL, delg->item)); | |
522 groups = g_list_remove(groups, delg); | |
523 g_free(delg); | |
524 | |
525 serv_save_config(); | |
228 | 526 |
527 // flush buddy list to cache | |
528 | |
529 do_export( (GtkWidget *) NULL, 0 ); | |
1 | 530 } |
531 | |
532 | |
533 | |
534 | |
535 | |
536 gboolean edit_drag_compare_func (GtkCTree *ctree, GtkCTreeNode *source_node, | |
537 GtkCTreeNode *new_parent, GtkCTreeNode *new_sibling) | |
538 { | |
539 gboolean leaf; | |
540 | |
541 gtk_ctree_get_node_info (ctree, source_node, NULL, | |
542 NULL, NULL, NULL, NULL, NULL, &leaf, NULL); | |
543 | |
544 | |
545 if (leaf) { | |
546 if (!new_parent) | |
547 return FALSE; | |
548 } else { | |
549 | |
550 if (new_parent) | |
551 return FALSE; | |
552 | |
553 } | |
554 | |
555 return TRUE; | |
556 } | |
557 | |
558 | |
559 | |
560 static void edit_tree_move (GtkCTree *ctree, GtkCTreeNode *child, GtkCTreeNode *parent, | |
561 GtkCTreeNode *sibling, gpointer data) | |
562 { | |
563 char *source; | |
564 char *target1; | |
565 char *target2; | |
566 | |
567 gtk_ctree_get_node_info (ctree, child, &source, | |
568 NULL, NULL, NULL, NULL, NULL, NULL, NULL); | |
569 if (parent) | |
570 gtk_ctree_get_node_info (ctree, parent, &target1, | |
571 NULL, NULL, NULL, NULL, NULL, NULL, NULL); | |
572 if (sibling) | |
573 gtk_ctree_get_node_info (ctree, sibling, &target2, | |
574 NULL, NULL, NULL, NULL, NULL, NULL, NULL); | |
575 | |
576 | |
577 if (!parent) { | |
578 GList *grps, *buds; | |
579 struct group *g, *g2; | |
580 GList *tmp; | |
581 int pos; | |
582 struct buddy *b; | |
583 /* Okay we've moved group order... */ | |
584 | |
585 g = find_group(source); | |
586 | |
587 gtk_widget_ref(g->tree); | |
588 | |
589 buds = g->members; | |
590 while(buds) { | |
591 b = (struct buddy *)buds->data; | |
592 gtk_widget_ref(b->item); | |
593 gtk_widget_ref(b->label); | |
594 gtk_widget_ref(b->idletime); | |
595 gtk_widget_ref(b->pix); | |
596 buds = buds->next; | |
597 } | |
598 | |
599 | |
600 | |
601 | |
602 pos = g_list_index(GTK_TREE(buddies)->children, g->item); | |
603 | |
604 tmp = g_list_append(NULL, g->item); | |
605 gtk_tree_remove_items(GTK_TREE(buddies), tmp); | |
606 g_list_free(tmp); | |
607 | |
608 groups = g_list_remove(groups, g); | |
609 | |
610 g->item = gtk_tree_item_new_with_label(g->name); | |
611 gtk_widget_show(g->item); | |
612 | |
613 if (sibling) { | |
614 g2 = find_group(target2); | |
615 pos = g_list_index(groups, g2); | |
616 if (pos == 0) { | |
617 groups = g_list_prepend(groups, g); | |
618 gtk_tree_prepend(GTK_TREE(buddies), g->item); | |
619 } else { | |
620 groups = g_list_insert(groups, g, pos); | |
621 gtk_tree_insert(GTK_TREE(buddies), g->item, pos); | |
622 } | |
623 | |
624 } else { | |
625 groups = g_list_append(groups, g); | |
626 gtk_tree_append(GTK_TREE(buddies), g->item); | |
627 | |
628 } | |
629 | |
630 gtk_tree_item_set_subtree (GTK_TREE_ITEM(g->item), g->tree); | |
631 gtk_tree_item_expand (GTK_TREE_ITEM(g->item)); | |
632 gtk_signal_connect(GTK_OBJECT(g->item), "button_press_event", | |
633 GTK_SIGNAL_FUNC(handle_click_group), | |
634 NULL); | |
635 gtk_object_set_user_data(GTK_OBJECT(g->item), NULL); | |
636 | |
637 gtk_widget_unref(g->tree); | |
638 | |
639 update_num_groups(); | |
640 | |
641 | |
642 buds = g->members; | |
643 | |
644 while(buds) { | |
645 b = (struct buddy *)buds->data; | |
646 set_buddy(b); | |
647 buds = buds->next; | |
648 } | |
649 | |
650 grps = groups; | |
651 while(grps) { | |
652 g = (struct group *)grps->data; | |
653 grps = grps->next; | |
654 } | |
655 | |
656 } else { | |
657 struct group *new_g, *old_g; | |
658 struct buddy *b, *s; | |
659 GtkWidget *gtree; | |
660 GtkWidget *owner; | |
661 GList *temp; | |
662 int pos; | |
663 | |
664 b = find_buddy(source); | |
665 new_g = find_group(target1); | |
666 old_g = find_group_by_buddy(source); | |
667 gtree = old_g->tree; | |
668 if (sibling) | |
669 s = find_buddy(target2); | |
670 else | |
671 s = NULL; | |
672 | |
673 old_g->members = g_list_remove(old_g->members, b); | |
674 | |
675 gtk_widget_ref(b->item); | |
676 gtk_widget_ref(b->label); | |
677 gtk_widget_ref(b->pix); | |
678 gtk_widget_ref(b->idletime); | |
679 gtk_widget_ref(gtree); | |
680 | |
681 owner = GTK_TREE(gtree)->tree_owner; | |
682 | |
683 temp = g_list_append(NULL, b->item); | |
684 gtk_tree_remove_items(GTK_TREE(old_g->tree), temp); | |
685 g_list_free(temp); | |
686 | |
687 if (gtree->parent == NULL){ | |
688 gtk_tree_item_set_subtree (GTK_TREE_ITEM(owner), gtree); | |
689 gtk_tree_item_expand (GTK_TREE_ITEM(owner)); | |
690 } | |
691 | |
692 if (!sibling) { | |
693 gtk_tree_append(GTK_TREE(new_g->tree), b->item); | |
694 new_g->members = g_list_append(new_g->members, b); | |
695 } else { | |
696 pos = g_list_index(new_g->members, s); | |
697 if (pos != 0) { | |
698 new_g->members = g_list_insert(new_g->members, b, pos); | |
699 gtk_tree_insert(GTK_TREE(new_g->tree), b->item, pos); | |
700 } else { | |
701 new_g->members = g_list_prepend(new_g->members, b); | |
702 gtk_tree_prepend(GTK_TREE(new_g->tree), b->item); | |
703 | |
704 } | |
705 } | |
706 | |
707 gtk_widget_unref(b->item); | |
708 gtk_widget_unref(b->label); | |
709 gtk_widget_unref(b->pix); | |
710 gtk_widget_unref(b->idletime); | |
711 gtk_widget_unref(gtree); | |
712 | |
713 gtk_ctree_expand(ctree, parent); | |
714 | |
715 update_num_groups(); | |
716 update_show_idlepix(); | |
717 set_buddy(b); | |
718 | |
719 | |
720 | |
721 | |
722 | |
723 } | |
724 | |
725 serv_save_config(); | |
228 | 726 |
727 // flush buddy list to cache | |
728 | |
729 do_export( (GtkWidget *) NULL, 0 ); | |
1 | 730 } |
731 | |
732 | |
733 | |
734 void build_edit_tree() | |
735 { | |
736 GtkCTreeNode *p = NULL, *n; | |
737 GList *grp = groups; | |
738 GList *mem; | |
739 struct group *g; | |
740 struct buddy *b; | |
741 char *text[1]; | |
742 | |
743 gtk_clist_freeze(GTK_CLIST(edittree)); | |
744 gtk_clist_clear(GTK_CLIST(edittree)); | |
745 | |
746 | |
747 while(grp) { | |
748 g = (struct group *)grp->data; | |
749 | |
750 text[0] = g->name; | |
751 | |
752 p = gtk_ctree_insert_node(GTK_CTREE(edittree), NULL, | |
753 NULL, text, 5, NULL, NULL, | |
754 NULL, NULL, 0, 1); | |
755 | |
756 n = NULL; | |
757 | |
758 mem = g->members; | |
759 | |
760 while(mem) { | |
761 b = (struct buddy *)mem->data; | |
762 | |
763 text[0] = b->name; | |
764 | |
765 n = gtk_ctree_insert_node(GTK_CTREE(edittree), | |
766 p, NULL, text, 5, | |
767 NULL, NULL, | |
768 NULL, NULL, 1, 1); | |
769 | |
770 mem = mem->next; | |
771 | |
772 } | |
773 grp = grp->next; | |
774 } | |
775 | |
776 gtk_clist_thaw(GTK_CLIST(edittree)); | |
777 | |
778 } | |
779 | |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
780 struct buddy *add_buddy(char *group, char *buddy, char *show) |
1 | 781 { |
782 struct buddy *b; | |
783 struct group *g; | |
784 GdkPixmap *pm; | |
785 GdkBitmap *bm; | |
786 GtkWidget *box; | |
787 | |
788 | |
789 if ((b = find_buddy(buddy)) != NULL) | |
790 return b; | |
791 | |
792 g = find_group(group); | |
793 | |
794 if (g == NULL) | |
795 g = add_group(group); | |
796 | |
797 b = (struct buddy *)g_new0(struct buddy, 1); | |
798 | |
799 if (!b) | |
800 return NULL; | |
801 | |
802 b->present = 0; | |
803 b->item = gtk_tree_item_new(); | |
804 | |
805 g_snprintf(b->name, sizeof(b->name), "%s", buddy); | |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
806 g_snprintf(b->show, sizeof(b->show), "%s", show ? (show[0] ? show : buddy) : buddy); |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
807 |
1 | 808 g->members = g_list_append(g->members, b); |
809 | |
810 | |
811 if (blist == NULL) | |
812 return b; | |
813 | |
814 box = gtk_hbox_new(FALSE, 1); | |
815 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
816 NULL, (gchar **)login_icon_xpm); | |
817 b->pix = gtk_pixmap_new(pm, bm); | |
818 | |
819 b->idle = 0; | |
515
b33ed0a7f49b
[gaim-migrate @ 525]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
514
diff
changeset
|
820 b->caps = 0; |
1 | 821 |
822 gtk_widget_show(b->pix); | |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
823 gdk_pixmap_unref(pm); |
804
17def2bb9720
[gaim-migrate @ 814]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
803
diff
changeset
|
824 gdk_bitmap_unref(bm); |
1 | 825 |
826 b->label = gtk_label_new(buddy); | |
827 gtk_misc_set_alignment(GTK_MISC(b->label), 0.0, 0.5); | |
828 | |
829 b->idletime = gtk_label_new(""); | |
830 | |
831 gtk_tree_append(GTK_TREE(g->tree),b->item); | |
832 gtk_container_add(GTK_CONTAINER(b->item), box); | |
833 | |
834 gtk_box_pack_start(GTK_BOX(box), b->pix, FALSE, FALSE, 1); | |
835 gtk_box_pack_start(GTK_BOX(box), b->label, TRUE, TRUE, 1); | |
836 gtk_box_pack_start(GTK_BOX(box), b->idletime, FALSE, FALSE, 1); | |
837 | |
838 gtk_widget_show(b->label); | |
839 gtk_widget_show(box); | |
840 | |
841 gtk_object_set_user_data(GTK_OBJECT(b->item), b); | |
842 | |
843 gtk_signal_connect(GTK_OBJECT(b->item), "button_press_event", | |
844 GTK_SIGNAL_FUNC(handle_click_buddy), b); | |
430 | 845 |
1 | 846 return b; |
847 } | |
848 | |
849 | |
850 struct group *add_group(char *group) | |
851 { | |
318
35796808896a
[gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
281
diff
changeset
|
852 struct group *g = find_group(group); |
35796808896a
[gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
281
diff
changeset
|
853 if (g) |
35796808896a
[gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
281
diff
changeset
|
854 return g; |
1 | 855 g = (struct group *)g_new0(struct group, 1); |
856 if (!g) | |
857 return NULL; | |
858 | |
859 strncpy(g->name, group, sizeof(g->name)); | |
860 groups = g_list_append(groups, g); | |
861 | |
862 if (blist == NULL) | |
863 return g; | |
864 | |
865 g->item = gtk_tree_item_new(); | |
866 g->label = gtk_label_new(g->name); | |
867 gtk_misc_set_alignment(GTK_MISC(g->label), 0.0, 0.5); | |
868 gtk_widget_show(g->label); | |
869 gtk_container_add(GTK_CONTAINER(g->item), g->label); | |
870 g->tree = gtk_tree_new(); | |
871 gtk_widget_show(g->item); | |
872 gtk_widget_show(g->tree); | |
873 gtk_tree_append(GTK_TREE(buddies), g->item); | |
874 gtk_tree_item_set_subtree(GTK_TREE_ITEM(g->item), g->tree); | |
875 gtk_tree_item_expand(GTK_TREE_ITEM(g->item)); | |
876 gtk_signal_connect(GTK_OBJECT(g->item), "button_press_event", | |
877 GTK_SIGNAL_FUNC(handle_click_group), | |
878 NULL); | |
879 gtk_object_set_user_data(GTK_OBJECT(g->item), NULL); | |
880 g->members = NULL; | |
881 | |
882 | |
883 build_edit_tree(); | |
884 | |
885 return g; | |
886 | |
887 } | |
888 | |
889 | |
890 static void do_del_buddy(GtkWidget *w, GtkCTree *ctree) | |
891 { | |
892 GtkCTreeNode *node; | |
893 char *bud, *grp; | |
894 struct buddy *b; | |
895 struct group *g; | |
896 GList *i; | |
897 | |
898 i = GTK_CLIST(edittree)->selection; | |
899 if (i) { | |
900 node = i->data; | |
901 | |
902 if (GTK_CTREE_ROW(node)->is_leaf) { | |
903 gtk_ctree_get_node_info (GTK_CTREE(edittree), node, &bud, | |
904 NULL, NULL, NULL, NULL, NULL, NULL, NULL); | |
905 | |
906 b = find_buddy(bud); | |
907 g = find_group_by_buddy(bud); | |
908 remove_buddy(g, b); | |
909 } else { | |
910 gtk_ctree_get_node_info (ctree, node, &grp, | |
911 NULL, NULL, NULL, NULL, NULL, NULL, NULL); | |
912 g = find_group(grp); | |
913 remove_group(g); | |
914 } | |
915 | |
916 build_edit_tree(); | |
917 serv_save_config(); | |
228 | 918 |
919 // flush buddy list to cache | |
920 | |
921 do_export( (GtkWidget *) NULL, 0 ); | |
922 | |
1 | 923 } else { |
924 /* Nothing selected. */ | |
925 } | |
926 update_num_groups(); | |
927 } | |
928 | |
929 | |
930 void gaimreg_callback(GtkWidget *widget) | |
931 { | |
932 show_register_dialog(); | |
933 } | |
934 | |
935 void import_callback(GtkWidget *widget, void *null) | |
936 { | |
937 show_import_dialog(); | |
938 } | |
939 | |
940 void export_callback(GtkWidget *widget, void *null) | |
941 { | |
942 show_export_dialog(); | |
943 } | |
944 | |
945 | |
946 | |
947 void do_quit() | |
948 { | |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
949 #ifdef GAIM_PLUGINS |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
950 GList *c; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
951 struct gaim_plugin *p; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
952 void (*gaim_plugin_remove)(); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
953 char *error; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
954 |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
955 /* first we tell those who have requested it we're quitting */ |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
774
diff
changeset
|
956 plugin_event(event_quit, 0, 0, 0); |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
957 |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
958 /* then we remove everyone in a mass suicide */ |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
959 c = plugins; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
960 while (c) { |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
961 p = (struct gaim_plugin *)c->data; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
962 gaim_plugin_remove = dlsym(p->handle, "gaim_plugin_remove"); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
963 if ((error = (char *)dlerror()) == NULL) |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
964 (*gaim_plugin_remove)(); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
965 /* we don't need to worry about removing callbacks since |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
966 * there won't be any more chance to call them back :) */ |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
967 dlclose(p->handle); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
968 g_free(p->filename); /* why do i bother? */ |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
969 g_free(p); |
403
d6f02d7f78d8
[gaim-migrate @ 413]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
391
diff
changeset
|
970 c = c->next; |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
971 } |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
972 #endif |
784
4c292b3f74ea
[gaim-migrate @ 794]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
973 #ifdef USE_PERL |
4c292b3f74ea
[gaim-migrate @ 794]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
974 perl_end(); |
4c292b3f74ea
[gaim-migrate @ 794]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
975 #endif |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
976 |
1 | 977 exit(0); |
978 } | |
979 | |
980 void add_buddy_callback(GtkWidget *widget, void *dummy) | |
981 { | |
982 char *grp = NULL; | |
983 GtkCTreeNode *node; | |
984 GList *i; | |
985 | |
986 i = GTK_CLIST(edittree)->selection; | |
987 if (i) { | |
988 node = i->data; | |
989 | |
990 if (GTK_CTREE_ROW(node)->is_leaf) { | |
991 node = GTK_CTREE_ROW(node)->parent; | |
992 } | |
993 | |
994 gtk_ctree_get_node_info (GTK_CTREE(edittree), node, &grp, | |
995 NULL, NULL, NULL, NULL, NULL, NULL, NULL); | |
996 } | |
997 show_add_buddy(NULL, grp); | |
998 | |
999 } | |
1000 | |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
1001 void add_group_callback(GtkWidget *widget, void *dummy) |
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
1002 { |
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
1003 show_add_group(); |
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
1004 } |
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
1005 |
1 | 1006 static void info_callback(GtkWidget *widget, GtkTree *tree) |
1007 { | |
1008 GList *i; | |
1009 struct buddy *b = NULL; | |
1010 i = GTK_TREE_SELECTION(tree); | |
1011 if (i) { | |
1012 b = gtk_object_get_user_data(GTK_OBJECT(i->data)); | |
1013 } else { | |
1014 return; | |
1015 } | |
1016 if (!b->name) | |
1017 return; | |
1018 serv_get_info(b->name); | |
1019 } | |
1020 | |
1021 | |
1022 void chat_callback(GtkWidget *widget, GtkTree *tree) | |
1023 { | |
1024 join_chat(); | |
1025 } | |
1026 | |
1027 struct group *find_group(char *group) | |
1028 { | |
1029 struct group *g; | |
1030 GList *grp = groups; | |
1031 char *grpname = g_malloc(strlen(group) + 1); | |
1032 | |
1033 strcpy(grpname, normalize(group)); | |
1034 while (grp) { | |
1035 g = (struct group *)grp->data; | |
1036 if (!strcasecmp(normalize(g->name), grpname)) { | |
1037 g_free(grpname); | |
1038 return g; | |
1039 } | |
1040 grp = grp->next; | |
1041 } | |
1042 | |
1043 g_free(grpname); | |
1044 return NULL; | |
1045 | |
1046 } | |
1047 | |
1048 | |
1049 struct group *find_group_by_buddy(char *who) | |
1050 { | |
1051 struct group *g; | |
1052 struct buddy *b; | |
1053 GList *grp = groups; | |
1054 GList *mem; | |
1055 char *whoname = g_malloc(strlen(who) + 1); | |
1056 | |
1057 strcpy(whoname, normalize(who)); | |
1058 | |
1059 while(grp) { | |
1060 g = (struct group *)grp->data; | |
1061 | |
1062 mem = g->members; | |
1063 while(mem) { | |
1064 b = (struct buddy *)mem->data; | |
1065 if (!strcasecmp(normalize(b->name), whoname)) { | |
1066 g_free(whoname); | |
1067 return g; | |
1068 } | |
1069 mem = mem->next; | |
1070 } | |
1071 grp = grp->next; | |
1072 } | |
1073 g_free(whoname); | |
1074 return NULL; | |
1075 } | |
1076 | |
1077 | |
1078 struct buddy *find_buddy(char *who) | |
1079 { | |
1080 struct group *g; | |
1081 struct buddy *b; | |
1082 GList *grp = groups; | |
1083 GList *mem; | |
1084 char *whoname = g_malloc(strlen(who) + 1); | |
1085 | |
1086 strcpy(whoname, normalize(who)); | |
1087 | |
1088 while(grp) { | |
1089 g = (struct group *)grp->data; | |
1090 | |
1091 mem = g->members; | |
1092 while(mem) { | |
1093 b = (struct buddy *)mem->data; | |
1094 if (!strcasecmp(normalize(b->name), whoname)) { | |
1095 g_free(whoname); | |
1096 return b; | |
1097 } | |
1098 mem = mem->next; | |
1099 } | |
1100 grp = grp->next; | |
1101 } | |
1102 g_free(whoname); | |
1103 return NULL; | |
1104 } | |
1105 | |
1106 | |
1107 void rem_bp(GtkWidget *w, struct buddy_pounce *b) | |
1108 { | |
1109 buddy_pounces = g_list_remove(buddy_pounces, b); | |
689
4e3f5d9cacd5
[gaim-migrate @ 699]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
1110 do_bp_menu(); |
4e3f5d9cacd5
[gaim-migrate @ 699]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
1111 save_prefs(); |
1 | 1112 } |
1113 | |
1114 void do_pounce(char *name) | |
1115 { | |
26 | 1116 char *who; |
1 | 1117 |
1118 struct buddy_pounce *b; | |
1119 struct conversation *c; | |
1120 | |
1121 GList *bp = buddy_pounces; | |
1122 | |
26 | 1123 who = g_strdup(normalize(name)); |
1 | 1124 |
1125 while(bp) { | |
1126 b = (struct buddy_pounce *)bp->data;; | |
26 | 1127 bp = bp->next; /* increment the list here because rem_bp can make our handle bad */ |
1128 | |
1 | 1129 if (!strcasecmp(who, normalize(b->name))) { |
1130 if (b->popup == 1) | |
1131 { | |
1132 c = find_conversation(name); | |
1133 if (c == NULL) | |
1134 c = new_conversation(name); | |
1135 } | |
1136 if (b->sendim == 1) | |
1137 { | |
1138 c = find_conversation(name); | |
1139 if (c == NULL) | |
1140 c = new_conversation(name); | |
1141 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
438
diff
changeset
|
1142 write_to_conv(c, b->message, WFLAG_SEND, NULL); |
1 | 1143 |
1144 escape_text(b->message); | |
1145 | |
1146 serv_send_im(name, b->message, 0); | |
1147 } | |
1148 | |
1149 rem_bp(NULL, b); | |
1150 | |
1151 } | |
1152 } | |
1153 g_free(who); | |
1154 } | |
1155 | |
1156 static void new_bp_callback(GtkWidget *w, char *name) | |
1157 { | |
1158 show_new_bp(name); | |
1159 } | |
1160 | |
1161 static void log_callback(GtkWidget *w, char *name) | |
1162 { | |
1163 struct conversation *c = find_conversation(name); | |
1164 | |
1165 if (find_log_info(name)) | |
1166 { | |
1167 if (c) { | |
1168 set_state_lock(1); | |
1169 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(c->log_button), FALSE); | |
1170 set_state_lock(0); | |
1171 } | |
1172 rm_log(find_log_info(name)); | |
1173 } | |
1174 else | |
1175 { | |
1176 if (c) { | |
700
d904bf694bd7
[gaim-migrate @ 710]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
696
diff
changeset
|
1177 show_log_dialog(c); |
1 | 1178 set_state_lock(1); |
1179 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(c->log_button), TRUE); | |
1180 set_state_lock(0); | |
1181 } | |
1182 } | |
1183 } | |
1184 | |
1185 void do_bp_menu() | |
1186 { | |
1187 GtkWidget *menuitem, *mess, *messmenu; | |
1188 static GtkWidget *remmenu; | |
1189 GtkWidget *remitem; | |
1190 GtkWidget *sep; | |
1191 GList *l; | |
1192 struct buddy_pounce *b; | |
1193 GList *bp = buddy_pounces; | |
1194 | |
1195 l = gtk_container_children(GTK_CONTAINER(bpmenu)); | |
1196 | |
1197 while(l) { | |
1198 gtk_widget_destroy(GTK_WIDGET(l->data)); | |
1199 l = l->next; | |
1200 } | |
1201 | |
1202 remmenu = gtk_menu_new(); | |
1203 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1204 menuitem = gtk_menu_item_new_with_label(_("New Buddy Pounce")); |
1 | 1205 gtk_menu_append(GTK_MENU(bpmenu), menuitem); |
1206 gtk_widget_show(menuitem); | |
1207 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(new_bp_callback), NULL); | |
1208 | |
1209 | |
1210 while(bp) { | |
1211 | |
1212 b = (struct buddy_pounce *)bp->data; | |
1213 remitem = gtk_menu_item_new_with_label(b->name); | |
1214 gtk_menu_append(GTK_MENU(remmenu), remitem); | |
1215 gtk_widget_show(remitem); | |
1216 gtk_signal_connect(GTK_OBJECT(remitem), "activate", GTK_SIGNAL_FUNC(rem_bp), b); | |
1217 | |
1218 bp = bp->next; | |
1219 | |
1220 } | |
1221 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1222 menuitem = gtk_menu_item_new_with_label(_("Remove Buddy Pounce")); |
1 | 1223 gtk_menu_append(GTK_MENU(bpmenu), menuitem); |
1224 gtk_widget_show(menuitem); | |
1225 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), remmenu); | |
1226 gtk_widget_show(remmenu); | |
1227 | |
1228 | |
1229 sep = gtk_hseparator_new(); | |
1230 menuitem = gtk_menu_item_new(); | |
1231 gtk_menu_append(GTK_MENU(bpmenu), menuitem); | |
1232 gtk_container_add(GTK_CONTAINER(menuitem), sep); | |
1233 gtk_widget_set_sensitive(menuitem, FALSE); | |
1234 gtk_widget_show(menuitem); | |
1235 gtk_widget_show(sep); | |
1236 | |
1237 bp = buddy_pounces;; | |
1238 | |
1239 while(bp) { | |
1240 | |
1241 b = (struct buddy_pounce *)bp->data; | |
1242 | |
1243 menuitem = gtk_menu_item_new_with_label(b->name); | |
1244 gtk_menu_append(GTK_MENU(bpmenu), menuitem); | |
1245 messmenu = gtk_menu_new(); | |
1246 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), messmenu); | |
1247 gtk_widget_show(menuitem); | |
1248 | |
1249 | |
1250 | |
1251 mess = gtk_menu_item_new_with_label(b->message); | |
1252 gtk_menu_append(GTK_MENU(messmenu), mess); | |
1253 gtk_widget_show(mess); | |
1254 | |
1255 bp = bp->next; | |
1256 | |
1257 } | |
1258 | |
1259 } | |
1260 | |
1261 | |
1262 gint log_timeout(char *name) | |
1263 { | |
1264 struct buddy *b; | |
119
66ec3865bd46
[gaim-migrate @ 129]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
1265 struct group *g; |
1 | 1266 |
1267 b = find_buddy(name); | |
1268 | |
1269 if(!b) | |
1270 return FALSE; | |
1271 | |
1272 b->log_timer = 0; | |
1273 | |
119
66ec3865bd46
[gaim-migrate @ 129]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
1274 if (!b->present) { |
1 | 1275 gtk_widget_hide(b->item); |
119
66ec3865bd46
[gaim-migrate @ 129]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
1276 g = find_group_by_buddy(name); |
120
991d5f0c6c90
[gaim-migrate @ 130]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
119
diff
changeset
|
1277 if (GTK_TREE_ITEM(g->item)->expanded) { |
991d5f0c6c90
[gaim-migrate @ 130]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
119
diff
changeset
|
1278 gtk_tree_item_collapse(GTK_TREE_ITEM(g->item)); |
991d5f0c6c90
[gaim-migrate @ 130]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
119
diff
changeset
|
1279 gtk_tree_item_expand(GTK_TREE_ITEM(g->item)); |
991d5f0c6c90
[gaim-migrate @ 130]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
119
diff
changeset
|
1280 } |
119
66ec3865bd46
[gaim-migrate @ 129]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
1281 } else |
1 | 1282 set_buddy(b); |
1283 | |
1284 return FALSE; | |
1285 } | |
1286 | |
1287 | |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1288 static char *caps_string(u_short caps) |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1289 { |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1290 static char buf[BUF_LEN]; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1291 int count = 0, i = 0; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1292 u_short bit = 1; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1293 while (bit <= AIM_CAPS_SENDFILE) { |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1294 if (bit & caps) { |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1295 switch (bit) { |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1296 case AIM_CAPS_BUDDYICON: |
514
44123888a941
[gaim-migrate @ 524]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
513
diff
changeset
|
1297 i += g_snprintf(buf + i, sizeof(buf) - i, _("%sBuddy Icon"), count ? ", " : ""); |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1298 break; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1299 case AIM_CAPS_VOICE: |
514
44123888a941
[gaim-migrate @ 524]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
513
diff
changeset
|
1300 i += g_snprintf(buf + i, sizeof(buf) - i, _("%sVoice"), count ? ", " : ""); |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1301 break; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1302 case AIM_CAPS_IMIMAGE: |
514
44123888a941
[gaim-migrate @ 524]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
513
diff
changeset
|
1303 i += g_snprintf(buf + i, sizeof(buf) - i, _("%sIM Image"), count ? ", " : ""); |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1304 break; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1305 case AIM_CAPS_CHAT: |
514
44123888a941
[gaim-migrate @ 524]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
513
diff
changeset
|
1306 i += g_snprintf(buf + i, sizeof(buf) - i, _("%sChat"), count ? ", " : ""); |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1307 break; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1308 case AIM_CAPS_GETFILE: |
514
44123888a941
[gaim-migrate @ 524]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
513
diff
changeset
|
1309 i += g_snprintf(buf + i, sizeof(buf) - i, _("%sGet File"), count ? ", " : ""); |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1310 break; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1311 case AIM_CAPS_SENDFILE: |
514
44123888a941
[gaim-migrate @ 524]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
513
diff
changeset
|
1312 i += g_snprintf(buf + i, sizeof(buf) - i, _("%sSend File"), count ? ", " : ""); |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1313 break; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1314 } |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1315 count++; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1316 } |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1317 bit <<= 1; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1318 } |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1319 return buf; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1320 } |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1321 |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1322 |
1 | 1323 void set_buddy(struct buddy *b) |
1324 { | |
1325 char infotip[256]; | |
1326 char idlet[16]; | |
1327 char warn[256]; | |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1328 char caps[256]; |
70 | 1329 char *who; |
1 | 1330 int i; |
1331 int ihrs, imin; | |
1332 time_t t; | |
1333 GdkPixmap *pm; | |
1334 GdkBitmap *bm; | |
1335 char *itime, *sotime; | |
1336 | |
1337 if (b->present) { | |
1338 time(&t); | |
1339 | |
1340 ihrs = (t - b->idle) / 3600; | |
1341 imin = ((t - b->idle) / 60) % 60; | |
1342 | |
1343 if (ihrs) | |
1344 g_snprintf(idlet, sizeof(idlet), "(%d:%02d)", ihrs, imin); | |
1345 else | |
1346 g_snprintf(idlet, sizeof(idlet), "(%02d)", imin); | |
1347 | |
1348 gtk_widget_hide(b->idletime); | |
1349 | |
1350 if (b->idle) | |
1351 gtk_label_set(GTK_LABEL(b->idletime), idlet); | |
1352 else | |
1353 gtk_label_set(GTK_LABEL(b->idletime), ""); | |
1354 if (display_options & OPT_DISP_SHOW_IDLETIME) | |
1355 gtk_widget_show(b->idletime); | |
1356 | |
1357 | |
1358 sotime = sec_to_text(t - b->signon + correction_time); | |
1359 if (b->idle) { | |
1360 itime = sec_to_text(t - b->idle); | |
1361 } else { | |
1362 itime = g_malloc(1); | |
1363 itime[0] = 0; | |
1364 } | |
1365 | |
1366 if (b->evil) { | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1367 g_snprintf(warn, sizeof(warn), _("Warnings: %d%%\n"), b->evil); |
1 | 1368 |
1369 } else | |
1370 warn[0] = '\0'; | |
1371 | |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1372 if (b->caps) { |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1373 g_snprintf(caps, sizeof(caps), _("Capabilities: %s\n"), caps_string(b->caps)); |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1374 } else |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1375 caps[0] = '\0'; |
1 | 1376 |
837
113205ae7e72
[gaim-migrate @ 847]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
824
diff
changeset
|
1377 i = g_snprintf(infotip, sizeof(infotip), _("Alias: %s \nScreen Name: %s\nLogged in: %s\n%s%s%s%s%s"), b->show, b->name, sotime, warn, ((b->idle) ? _("Idle: ") : ""), itime, ((b->idle) ? "\n" : ""), caps); |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1378 |
1 | 1379 gtk_tooltips_set_tip(tips, GTK_WIDGET(b->item), infotip, ""); |
1380 | |
1381 g_free(sotime); | |
1382 g_free(itime); | |
1383 | |
1384 | |
1385 | |
121
3571b593f423
[gaim-migrate @ 131]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
120
diff
changeset
|
1386 /* this check should also depend on whether they left, |
3571b593f423
[gaim-migrate @ 131]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
120
diff
changeset
|
1387 * and signed on again before they got erased */ |
3571b593f423
[gaim-migrate @ 131]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
120
diff
changeset
|
1388 if (!GTK_WIDGET_VISIBLE(b->item) || b->present == 1) { |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
774
diff
changeset
|
1389 plugin_event(event_buddy_signon, b->name, 0, 0); |
1 | 1390 |
1391 play_sound(BUDDY_ARRIVE); | |
121
3571b593f423
[gaim-migrate @ 131]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
120
diff
changeset
|
1392 b->present = 2; |
1 | 1393 |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
1394 who = g_malloc(sizeof(b->show) + 10); |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
1395 strcpy(who, b->show); |
70 | 1396 gtk_label_set(GTK_LABEL(b->label), who); |
1397 g_free(who); | |
1398 | |
1 | 1399 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, |
1400 NULL, (gchar **)login_icon_xpm); | |
1401 gtk_widget_hide(b->pix); | |
1402 gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm); | |
1403 if (display_options & OPT_DISP_SHOW_PIXMAPS) | |
1404 gtk_widget_show(b->pix); | |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1405 gdk_pixmap_unref(pm); |
804
17def2bb9720
[gaim-migrate @ 814]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
803
diff
changeset
|
1406 gdk_bitmap_unref(bm); |
1 | 1407 |
430 | 1408 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, |
1409 NULL, (gchar **)login_icon_xpm); | |
1410 | |
436 | 1411 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
1412 BuddyTickerAddUser( b->name, pm, bm ); | |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1413 gdk_pixmap_unref(pm); |
804
17def2bb9720
[gaim-migrate @ 814]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
803
diff
changeset
|
1414 gdk_bitmap_unref(bm); |
430 | 1415 |
1 | 1416 if (display_options & OPT_DISP_SHOW_LOGON) { |
1417 struct conversation *c = find_conversation(b->name); | |
1418 if (c) { | |
1419 char tmp[1024]; | |
1420 | |
1421 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1422 g_snprintf(tmp, sizeof(tmp), _("<HR><B>%s logged in%s%s.</B><BR><HR>"), b->name, |
1 | 1423 ((display_options & OPT_DISP_SHOW_TIME) ? " @ " : ""), |
1424 ((display_options & OPT_DISP_SHOW_TIME) ? date() : "")); | |
1425 | |
1426 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
438
diff
changeset
|
1427 write_to_conv(c, tmp, WFLAG_SYSTEM, NULL); |
1 | 1428 |
1429 } | |
1430 } | |
1431 | |
1432 | |
1433 gtk_widget_show(b->item); | |
1434 gtk_widget_show(b->label); | |
58 | 1435 b->log_timer = gtk_timeout_add(10000, (GtkFunction) log_timeout, b->name); |
436 | 1436 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
1437 gtk_timeout_add(10000, (GtkFunction) BuddyTickerLogonTimeout, b->name); | |
1 | 1438 update_num_groups(); |
1439 update_show_idlepix(); | |
1440 setup_buddy_chats(); | |
1441 return; | |
1442 } | |
1443 | |
1444 | |
1445 | |
1446 if (!b->log_timer) { | |
1447 gtk_widget_hide(b->pix); | |
1448 if (b->uc & UC_UNAVAILABLE) { | |
1449 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
1450 NULL, (gchar **)away_icon_xpm); | |
1451 gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm); | |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1452 gdk_pixmap_unref(pm); |
804
17def2bb9720
[gaim-migrate @ 814]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
803
diff
changeset
|
1453 gdk_bitmap_unref(bm); |
436 | 1454 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
1455 { | |
1456 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
430 | 1457 NULL, (gchar **)away_icon_xpm); |
436 | 1458 BuddyTickerSetPixmap(b->name, pm, bm); |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1459 gdk_pixmap_unref(pm); |
804
17def2bb9720
[gaim-migrate @ 814]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
803
diff
changeset
|
1460 gdk_bitmap_unref(bm); |
436 | 1461 } |
1 | 1462 } else if (b->uc & UC_AOL) { |
1463 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
1464 NULL, (gchar **)aol_icon_xpm); | |
1465 gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm); | |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1466 gdk_pixmap_unref(pm); |
804
17def2bb9720
[gaim-migrate @ 814]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
803
diff
changeset
|
1467 gdk_bitmap_unref(bm); |
436 | 1468 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
1469 { | |
1470 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
430 | 1471 NULL, (gchar **)aol_icon_xpm); |
436 | 1472 BuddyTickerSetPixmap(b->name, pm, bm); |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1473 gdk_pixmap_unref(pm); |
804
17def2bb9720
[gaim-migrate @ 814]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
803
diff
changeset
|
1474 gdk_bitmap_unref(bm); |
436 | 1475 } |
1 | 1476 } else if (b->uc & UC_NORMAL) { |
1477 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
1478 NULL, (gchar **)free_icon_xpm); | |
1479 gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm); | |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1480 gdk_pixmap_unref(pm); |
804
17def2bb9720
[gaim-migrate @ 814]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
803
diff
changeset
|
1481 gdk_bitmap_unref(bm); |
436 | 1482 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
1483 { | |
1484 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
430 | 1485 NULL, (gchar **)free_icon_xpm); |
436 | 1486 BuddyTickerSetPixmap(b->name, pm, bm); |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1487 gdk_pixmap_unref(pm); |
804
17def2bb9720
[gaim-migrate @ 814]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
803
diff
changeset
|
1488 gdk_bitmap_unref(bm); |
436 | 1489 } |
1 | 1490 } else if (b->uc & UC_ADMIN) { |
1491 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
1492 NULL, (gchar **)admin_icon_xpm); | |
1493 gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm); | |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1494 gdk_pixmap_unref(pm); |
804
17def2bb9720
[gaim-migrate @ 814]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
803
diff
changeset
|
1495 gdk_bitmap_unref(bm); |
436 | 1496 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
1497 { | |
1498 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
430 | 1499 NULL, (gchar **)admin_icon_xpm); |
436 | 1500 BuddyTickerSetPixmap(b->name, pm, bm); |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1501 gdk_pixmap_unref(pm); |
804
17def2bb9720
[gaim-migrate @ 814]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
803
diff
changeset
|
1502 gdk_bitmap_unref(bm); |
436 | 1503 } |
1 | 1504 } else if (b->uc & UC_UNCONFIRMED) { |
1505 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
1506 NULL, (gchar **)dt_icon_xpm); | |
1507 gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm); | |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1508 gdk_pixmap_unref(pm); |
804
17def2bb9720
[gaim-migrate @ 814]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
803
diff
changeset
|
1509 gdk_bitmap_unref(bm); |
436 | 1510 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
1511 { | |
1512 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
430 | 1513 NULL, (gchar **)dt_icon_xpm); |
436 | 1514 BuddyTickerSetPixmap(b->name, pm, bm); |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1515 gdk_pixmap_unref(pm); |
804
17def2bb9720
[gaim-migrate @ 814]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
803
diff
changeset
|
1516 gdk_bitmap_unref(bm); |
436 | 1517 } |
1 | 1518 } else { |
1519 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
1520 NULL, (gchar **)no_icon_xpm); | |
1521 gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm); | |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1522 gdk_pixmap_unref(pm); |
804
17def2bb9720
[gaim-migrate @ 814]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
803
diff
changeset
|
1523 gdk_bitmap_unref(bm); |
436 | 1524 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
1525 { | |
1526 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
430 | 1527 NULL, (gchar **)no_icon_xpm); |
436 | 1528 BuddyTickerSetPixmap(b->name, pm, bm); |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1529 gdk_pixmap_unref(pm); |
804
17def2bb9720
[gaim-migrate @ 814]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
803
diff
changeset
|
1530 gdk_bitmap_unref(bm); |
436 | 1531 } |
1 | 1532 } |
1533 if (display_options & OPT_DISP_SHOW_PIXMAPS) | |
1534 gtk_widget_show(b->pix); | |
1535 } | |
1536 | |
1537 | |
1538 | |
1539 } else { | |
59 | 1540 if (GTK_WIDGET_VISIBLE(b->item)) { |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
774
diff
changeset
|
1541 plugin_event(event_buddy_signoff, b->name, 0, 0); |
1 | 1542 play_sound(BUDDY_LEAVE); |
1543 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
1544 NULL, (gchar **)logout_icon_xpm); | |
1545 gtk_widget_hide(b->pix); | |
1546 gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm); | |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1547 if (display_options & OPT_DISP_SHOW_PIXMAPS) |
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1548 gtk_widget_show(b->pix); |
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1549 gdk_pixmap_unref(pm); |
804
17def2bb9720
[gaim-migrate @ 814]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
803
diff
changeset
|
1550 gdk_bitmap_unref(bm); |
430 | 1551 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, |
1552 NULL, (gchar **)logout_icon_xpm); | |
436 | 1553 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
1554 BuddyTickerSetPixmap( b->name, pm, bm ); | |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1555 gdk_pixmap_unref(pm); |
804
17def2bb9720
[gaim-migrate @ 814]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
803
diff
changeset
|
1556 gdk_bitmap_unref(bm); |
1 | 1557 if (display_options & OPT_DISP_SHOW_LOGON) { |
1558 struct conversation *c = find_conversation(b->name); | |
1559 if (c) { | |
1560 char tmp[1024]; | |
1561 | |
1562 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1563 g_snprintf(tmp, sizeof(tmp), _("<HR><B>%s logged out%s%s.</B><BR><HR>"), b->name, |
1 | 1564 ((display_options & OPT_DISP_SHOW_TIME) ? " @ " : ""), |
1565 ((display_options & OPT_DISP_SHOW_TIME) ? date() : "")); | |
1566 | |
1567 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
438
diff
changeset
|
1568 write_to_conv(c, tmp, WFLAG_SYSTEM, NULL); |
1 | 1569 |
1570 } | |
1571 } | |
58 | 1572 b->log_timer = gtk_timeout_add(10000, (GtkFunction)log_timeout, b->name); |
436 | 1573 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
1574 gtk_timeout_add(10000, (GtkFunction)BuddyTickerLogoutTimeout, b->name); | |
1 | 1575 update_num_groups(); |
1576 update_show_idlepix(); | |
1577 } | |
1578 } | |
1579 setup_buddy_chats(); | |
1580 } | |
1581 | |
1582 | |
1583 static void move_blist_window(GtkWidget *w, GdkEventConfigure *e, void *dummy) | |
1584 { | |
1585 int x, y, width, height; | |
1586 int save = 0; | |
1587 gdk_window_get_position(blist->window, &x, &y); | |
1588 gdk_window_get_size(blist->window, &width, &height); | |
1589 | |
1590 if(e->send_event) { /* Is a position event */ | |
1591 if (blist_pos.x != x || blist_pos.y != y) | |
1592 save = 1; | |
1593 blist_pos.x = x; | |
1594 blist_pos.y = y; | |
1595 } else { /* Is a size event */ | |
1596 if (blist_pos.xoff != x || blist_pos.yoff != y || | |
1597 blist_pos.width != width || blist_pos.width != width) | |
1598 save = 1; | |
1599 | |
1600 blist_pos.width = width; | |
1601 blist_pos.height = height; | |
1602 blist_pos.xoff = x; | |
1603 blist_pos.yoff = y; | |
1604 } | |
1605 | |
1606 if (save) | |
1607 save_prefs(); | |
1608 | |
1609 } | |
1610 | |
1611 | |
1612 /******************************************************************* | |
1613 * | |
1614 * Helper funs for making the menu | |
1615 * | |
1616 *******************************************************************/ | |
1617 | |
1618 void gaim_seperator(GtkWidget *menu) | |
1619 { | |
1620 GtkWidget *sep, *menuitem; | |
1621 sep = gtk_hseparator_new(); | |
1622 menuitem = gtk_menu_item_new(); | |
1623 gtk_menu_append(GTK_MENU(menu), menuitem); | |
1624 gtk_container_add(GTK_CONTAINER(menuitem), sep); | |
1625 gtk_widget_set_sensitive(menuitem, FALSE); | |
1626 gtk_widget_show(menuitem); | |
1627 gtk_widget_show(sep); | |
1628 } | |
1629 | |
1630 GtkWidget *gaim_new_item(GtkWidget *menu, const char *str, GtkSignalFunc sf) | |
1631 { | |
1632 GtkWidget *menuitem; | |
1633 menuitem = gtk_menu_item_new_with_label(str); | |
1634 if (menu) | |
1635 gtk_menu_append(GTK_MENU(menu), menuitem); | |
1636 gtk_widget_show(menuitem); | |
1637 if (sf) | |
1638 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", sf, NULL); | |
1639 return menuitem; | |
1640 } | |
1641 | |
714 | 1642 GtkWidget *gaim_new_item_with_pixmap(GtkWidget *menu, const char *str, char **xpm, GtkSignalFunc sf) |
1643 { | |
1644 GtkWidget *menuitem; | |
1645 GtkWidget *hbox; | |
1646 GtkWidget *label; | |
1647 GtkWidget *pixmap; | |
1648 GdkPixmap *pm; | |
1649 GdkBitmap *mask; | |
1650 | |
1651 menuitem = gtk_menu_item_new(); | |
1652 gtk_widget_show(menuitem); | |
1653 | |
1654 /* Create our container */ | |
718 | 1655 hbox = gtk_hbox_new(FALSE, 2); |
714 | 1656 |
1657 /* Create our pixmap and pack it */ | |
719
7e5523de52e2
[gaim-migrate @ 729]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
718
diff
changeset
|
1658 gtk_widget_realize(menu->parent); |
714 | 1659 pm = gdk_pixmap_create_from_xpm_d(menu->parent->window, &mask, NULL, xpm); |
1660 | |
1661 pixmap = gtk_pixmap_new(pm, mask); | |
1662 gtk_widget_show(pixmap); | |
803
7f75b17d4e14
[gaim-migrate @ 813]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
801
diff
changeset
|
1663 gdk_pixmap_unref(pm); |
804
17def2bb9720
[gaim-migrate @ 814]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
803
diff
changeset
|
1664 gdk_bitmap_unref(mask); |
714 | 1665 |
718 | 1666 gtk_box_pack_start(GTK_BOX(hbox), pixmap, FALSE, FALSE, 2); |
1667 | |
1668 /* Create our label and pack it */ | |
714 | 1669 |
718 | 1670 label = gtk_label_new(str); |
1671 gtk_widget_show(label); | |
1672 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); | |
1673 | |
714 | 1674 /* And finally, pack our box within our menu item */ |
1675 | |
1676 gtk_container_add(GTK_CONTAINER(menuitem), hbox); | |
1677 gtk_widget_show(hbox); | |
1678 | |
1679 if (menu) | |
1680 gtk_menu_append(GTK_MENU(menu), menuitem); | |
1681 | |
1682 if (sf) | |
1683 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", sf, NULL); | |
1684 return menuitem; | |
1685 } | |
1686 | |
1 | 1687 |
1688 | |
696
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1689 void build_imchat_box(gboolean on) |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1690 { |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1691 if (on) { |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1692 if (imchatbox) return; |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1693 |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1694 imbutton = gtk_button_new_with_label(_("IM")); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1695 infobutton = gtk_button_new_with_label(_("Info")); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1696 chatbutton = gtk_button_new_with_label(_("Chat")); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1697 |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1698 imchatbox = gtk_hbox_new(TRUE, 10); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1699 |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1700 if (display_options & OPT_DISP_COOL_LOOK) |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1701 { |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1702 gtk_button_set_relief(GTK_BUTTON(imbutton), GTK_RELIEF_NONE); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1703 gtk_button_set_relief(GTK_BUTTON(infobutton), GTK_RELIEF_NONE); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1704 gtk_button_set_relief(GTK_BUTTON(chatbutton), GTK_RELIEF_NONE); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1705 } |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1706 |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1707 /* Put the buttons in the hbox */ |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1708 gtk_widget_show(imbutton); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1709 gtk_widget_show(chatbutton); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1710 gtk_widget_show(infobutton); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1711 |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1712 gtk_box_pack_start(GTK_BOX(imchatbox), imbutton, TRUE, TRUE, 0); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1713 gtk_box_pack_start(GTK_BOX(imchatbox), infobutton, TRUE, TRUE, 0); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1714 gtk_box_pack_start(GTK_BOX(imchatbox), chatbutton, TRUE, TRUE, 0); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1715 gtk_container_border_width(GTK_CONTAINER(imchatbox), 10); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1716 |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1717 gtk_signal_connect(GTK_OBJECT(imbutton), "clicked", GTK_SIGNAL_FUNC(show_im_dialog), buddies); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1718 gtk_signal_connect(GTK_OBJECT(infobutton), "clicked", GTK_SIGNAL_FUNC(info_callback), buddies); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1719 gtk_signal_connect(GTK_OBJECT(chatbutton), "clicked", GTK_SIGNAL_FUNC(chat_callback), buddies); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1720 |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1721 gtk_tooltips_set_tip(tips,infobutton, _("Information on selected Buddy"), "Penguin"); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1722 gtk_tooltips_set_tip(tips,imbutton, _("Send Instant Message"), "Penguin"); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1723 gtk_tooltips_set_tip(tips,chatbutton, _("Start/join a Buddy Chat"), "Penguin"); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1724 |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1725 gtk_box_pack_start(GTK_BOX(buddypane), imchatbox, FALSE, FALSE, 0); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1726 |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1727 gtk_widget_show(imchatbox); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1728 } else { |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1729 if (imchatbox) |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1730 gtk_widget_destroy(imchatbox); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1731 imchatbox = NULL; |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1732 } |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1733 } |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1734 |
1 | 1735 |
1736 | |
1737 void show_buddy_list() | |
1738 { | |
1739 | |
1740 /* Build the buddy list, based on *config */ | |
1741 | |
1742 GtkWidget *sw; | |
1743 GtkWidget *menu; | |
1744 GtkWidget *findmenu; | |
798
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
1745 #ifdef USE_PERL |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
1746 GtkWidget *perlmenu; |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
1747 #endif |
1 | 1748 GtkWidget *setmenu; |
1749 GtkWidget *menubar; | |
1750 GtkWidget *vbox; | |
1751 GtkWidget *menuitem; | |
1752 GtkWidget *notebook; | |
1753 GtkWidget *label; | |
1754 GtkWidget *bbox; | |
1755 GtkWidget *tbox; | |
1756 | |
1757 | |
1758 #ifdef USE_APPLET | |
1759 blist = gtk_window_new(GTK_WINDOW_DIALOG); | |
1760 #else | |
1761 blist = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
1762 #endif | |
1763 | |
1764 gtk_widget_realize(blist); | |
1765 aol_icon(blist->window); | |
1766 | |
1767 gtk_window_set_policy(GTK_WINDOW(blist), TRUE, TRUE, TRUE); | |
1768 | |
1769 menubar = gtk_menu_bar_new(); | |
1770 | |
1771 menu = gtk_menu_new(); | |
1772 | |
1773 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1774 menuitem = gaim_new_item(NULL, _("File"), NULL); |
1 | 1775 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu); |
1776 gtk_menu_bar_append(GTK_MENU_BAR(menubar), menuitem); | |
1777 | |
714 | 1778 // gaim_new_item(menu, _("Add A Buddy"), GTK_SIGNAL_FUNC(add_buddy_callback)); |
1779 gaim_new_item_with_pixmap(menu, _("Add A Buddy"), add_small_xpm, GTK_SIGNAL_FUNC(add_buddy_callback)); | |
870 | 1780 gaim_new_item_with_pixmap(menu, _("Join A Chat"), pounce_small_xpm, GTK_SIGNAL_FUNC(chat_callback)); |
1 | 1781 gaim_seperator(menu); |
718 | 1782 gaim_new_item_with_pixmap(menu, _("Import Buddy List"), import_small_xpm, GTK_SIGNAL_FUNC(import_callback)); |
733 | 1783 gaim_new_item_with_pixmap(menu, _("Export Buddy List"), export_small_xpm,GTK_SIGNAL_FUNC(export_callback)); |
1 | 1784 if (!(general_options & OPT_GEN_REGISTERED)) |
1785 { | |
1786 gaim_seperator(menu); | |
718 | 1787 gaim_new_item_with_pixmap(menu, _("Register"), add_small_xpm, GTK_SIGNAL_FUNC(gaimreg_callback)); |
1 | 1788 } |
1789 gaim_seperator(menu); | |
733 | 1790 gaim_new_item_with_pixmap(menu, _("Signoff"), logout_icon_xpm, GTK_SIGNAL_FUNC(signoff)); |
1 | 1791 |
1792 #ifndef USE_APPLET | |
727 | 1793 gaim_new_item_with_pixmap(menu, _("Quit"), exit_small_xpm, GTK_SIGNAL_FUNC(do_quit)); |
1 | 1794 #else |
727 | 1795 gaim_new_item_with_pixmap(menu, _("Close"), close_small_xpm, GTK_SIGNAL_FUNC(applet_destroy_buddy)); |
1 | 1796 #endif |
1797 | |
1798 menu = gtk_menu_new(); | |
1799 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1800 menuitem = gaim_new_item(NULL, _("Tools"), NULL); |
1 | 1801 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu); |
1802 gtk_menu_bar_append(GTK_MENU_BAR(menubar), menuitem); | |
1803 | |
1804 awaymenu = gtk_menu_new(); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1805 menuitem = gaim_new_item(menu, _("Away"), NULL); |
1 | 1806 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), awaymenu); |
1807 do_away_menu(); | |
1808 | |
1809 bpmenu = gtk_menu_new(); | |
865 | 1810 menuitem = gaim_new_item_with_pixmap(menu, _("Buddy Pounce"), pounce_small_xpm, NULL); |
1 | 1811 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), bpmenu); |
1812 do_bp_menu(); | |
1813 | |
1814 gaim_seperator(menu); | |
1815 | |
1816 findmenu = gtk_menu_new(); | |
1817 gtk_widget_show(findmenu); | |
801 | 1818 menuitem = gaim_new_item_with_pixmap(menu, _("Search for Buddy"), search_small_xpm, NULL); |
1 | 1819 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), findmenu); |
1820 gtk_widget_show(menuitem); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1821 menuitem = gtk_menu_item_new_with_label(_("by Email")); |
1 | 1822 gtk_menu_append(GTK_MENU(findmenu), menuitem); |
1823 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(show_find_email), NULL); | |
1824 gtk_widget_show(menuitem); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1825 menuitem = gtk_menu_item_new_with_label(_("by Dir Info")); |
1 | 1826 gtk_menu_append(GTK_MENU(findmenu), menuitem); |
1827 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(show_find_info), NULL); | |
1828 gtk_widget_show(menuitem); | |
1829 | |
1830 setmenu = gtk_menu_new(); | |
1831 gtk_widget_show(setmenu); | |
864 | 1832 //menuitem = gaim_new_item(menu, _("Settings"), NULL); |
1833 menuitem = gaim_new_item_with_pixmap(menu, _("Settings"), prefs_small_xpm, NULL); | |
1 | 1834 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), setmenu); |
864 | 1835 //gtk_widget_show(menuitem); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1836 menuitem = gtk_menu_item_new_with_label(_("User Info")); |
1 | 1837 gtk_menu_append(GTK_MENU(setmenu), menuitem); |
1838 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(show_set_info), NULL); | |
1839 gtk_widget_show(menuitem); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1840 menuitem = gtk_menu_item_new_with_label(_("Directory Info")); |
1 | 1841 gtk_menu_append(GTK_MENU(setmenu), menuitem); |
1842 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(show_set_dir), NULL); | |
1843 gtk_widget_show(menuitem); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1844 menuitem = gtk_menu_item_new_with_label(_("Change Password")); |
146 | 1845 gtk_menu_append(GTK_MENU(setmenu), menuitem); |
1846 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(show_change_passwd), NULL); | |
1847 gtk_widget_show(menuitem); | |
1 | 1848 gaim_seperator(menu); |
1849 | |
801 | 1850 gaim_new_item_with_pixmap(menu, _("Preferences"), prefs_small_xpm, GTK_SIGNAL_FUNC(show_prefs)); |
90
f5b305c0d974
[gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
87
diff
changeset
|
1851 |
152
cb0d3ec5a4c8
[gaim-migrate @ 162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
150
diff
changeset
|
1852 #ifdef GAIM_PLUGINS |
801 | 1853 gaim_new_item_with_pixmap(menu, _("Plugins"), plugins_small_xpm, GTK_SIGNAL_FUNC(show_plugins)); |
152
cb0d3ec5a4c8
[gaim-migrate @ 162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
150
diff
changeset
|
1854 #endif |
798
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
1855 #ifdef USE_PERL |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
1856 perlmenu = gtk_menu_new(); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
1857 gtk_widget_show(perlmenu); |
864 | 1858 menuitem = gaim_new_item_with_pixmap(menu, _("Perl"), plugins_small_xpm, NULL); |
798
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
1859 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), perlmenu); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
1860 gtk_widget_show(menuitem); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
1861 menuitem = gtk_menu_item_new_with_label(_("Load Script")); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
1862 gtk_menu_append(GTK_MENU(perlmenu), menuitem); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
1863 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(load_perl_script), NULL); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
1864 gtk_widget_show(menuitem); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
1865 menuitem = gtk_menu_item_new_with_label(_("Unload All Scripts")); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
1866 gtk_menu_append(GTK_MENU(perlmenu), menuitem); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
1867 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(unload_perl_scripts), NULL); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
1868 gtk_widget_show(menuitem); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
1869 menuitem = gtk_menu_item_new_with_label(_("List Scripts")); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
1870 gtk_menu_append(GTK_MENU(perlmenu), menuitem); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
1871 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(list_perl_scripts), NULL); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
1872 gtk_widget_show(menuitem); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
1873 #endif |
90
f5b305c0d974
[gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
87
diff
changeset
|
1874 |
1 | 1875 menu = gtk_menu_new(); |
1876 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1877 menuitem = gaim_new_item(NULL, _("Help"), NULL); |
1 | 1878 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu); |
1879 gtk_menu_item_right_justify(GTK_MENU_ITEM(menuitem)); | |
1880 gtk_menu_bar_append(GTK_MENU_BAR(menubar), menuitem); | |
1881 | |
864 | 1882 gaim_new_item(menu, _("About Gaim"), show_about); |
1 | 1883 |
1884 gtk_widget_show(menubar); | |
1885 | |
1886 vbox = gtk_vbox_new(FALSE, 10); | |
1887 | |
1888 notebook = gtk_notebook_new(); | |
1889 | |
1890 | |
1891 | |
1892 | |
1893 /* Do buddy list stuff */ | |
1894 | |
1895 buddypane = gtk_vbox_new(FALSE, 0); | |
1896 | |
1897 buddies = gtk_tree_new(); | |
1898 sw = gtk_scrolled_window_new(NULL, NULL); | |
1899 | |
1900 tips = gtk_tooltips_new(); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1901 gtk_object_set_data(GTK_OBJECT(blist), _("Buddy List"), tips); |
1 | 1902 |
1903 /* Now the buddy list */ | |
1904 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw),buddies); | |
1905 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
1906 GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC); | |
1907 gtk_widget_set_usize(sw,200,200); | |
1908 gtk_widget_show(buddies); | |
1909 gtk_widget_show(sw); | |
1910 | |
1911 gtk_box_pack_start(GTK_BOX(buddypane), sw, TRUE, TRUE, 0); | |
1912 gtk_widget_show(buddypane); | |
1913 | |
696
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1914 if (!(display_options & OPT_DISP_NO_BUTTONS)) |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
1915 build_imchat_box(TRUE); |
1 | 1916 |
1917 | |
1918 /* Swing the edit buddy */ | |
1919 editpane = gtk_vbox_new(FALSE, 0); | |
1920 | |
1921 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1922 addbutton = gtk_button_new_with_label(_("Add")); |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
1923 groupbutton = gtk_button_new_with_label(_("Group")); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1924 rembutton = gtk_button_new_with_label(_("Remove")); |
535
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
1925 |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
1926 if (display_options & OPT_DISP_COOL_LOOK) |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
1927 { |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
1928 gtk_button_set_relief(GTK_BUTTON(addbutton), GTK_RELIEF_NONE); |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
1929 gtk_button_set_relief(GTK_BUTTON(groupbutton), GTK_RELIEF_NONE); |
535
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
1930 gtk_button_set_relief(GTK_BUTTON(rembutton), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
1931 } |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
1932 |
1 | 1933 edittree = gtk_ctree_new(1, 0); |
1934 gtk_ctree_set_line_style (GTK_CTREE(edittree), GTK_CTREE_LINES_SOLID); | |
1935 gtk_ctree_set_expander_style(GTK_CTREE(edittree), GTK_CTREE_EXPANDER_SQUARE); | |
1936 gtk_clist_set_reorderable(GTK_CLIST(edittree), TRUE); | |
1937 | |
1938 gtk_ctree_set_drag_compare_func (GTK_CTREE(edittree), | |
1939 (GtkCTreeCompareDragFunc)edit_drag_compare_func); | |
1940 | |
1941 | |
1942 gtk_signal_connect_after (GTK_OBJECT (edittree), "tree_move", | |
1943 GTK_SIGNAL_FUNC (edit_tree_move), NULL); | |
1944 | |
1945 | |
1946 bbox = gtk_hbox_new(TRUE, 10); | |
1947 tbox = gtk_scrolled_window_new(NULL, NULL); | |
1948 /* Put the buttons in the box */ | |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
1949 gtk_box_pack_start(GTK_BOX(bbox), addbutton, TRUE, TRUE, 0); |
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
1950 gtk_box_pack_start(GTK_BOX(bbox), groupbutton, TRUE, TRUE, 0); |
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
1951 gtk_box_pack_start(GTK_BOX(bbox), rembutton, TRUE, TRUE, 0); |
1 | 1952 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1953 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
|
1954 gtk_tooltips_set_tip(tips, groupbutton, _("Add a new Group"), "Penguin"); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1955 gtk_tooltips_set_tip(tips, rembutton, _("Remove selected Buddy"), "Penguin"); |
1 | 1956 |
1957 /* And the boxes in the box */ | |
1958 gtk_box_pack_start(GTK_BOX(editpane), tbox, TRUE, TRUE, 5); | |
1959 gtk_box_pack_start(GTK_BOX(editpane), bbox, FALSE, FALSE, 5); | |
1960 | |
1961 /* Handle closes right */ | |
1962 | |
1963 | |
1964 | |
1965 /* Finish up */ | |
1966 gtk_widget_show(addbutton); | |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
1967 gtk_widget_show(groupbutton); |
1 | 1968 gtk_widget_show(rembutton); |
1969 gtk_widget_show(edittree); | |
1970 gtk_widget_show(tbox); | |
1971 gtk_widget_show(bbox); | |
1972 gtk_widget_show(editpane); | |
1973 | |
1974 | |
535
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
1975 |
703
20553b584ccb
[gaim-migrate @ 713]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
700
diff
changeset
|
1976 update_button_pix(); |
20553b584ccb
[gaim-migrate @ 713]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
700
diff
changeset
|
1977 |
1 | 1978 |
1979 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1980 label = gtk_label_new(_("Online")); |
1 | 1981 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), buddypane, label); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1982 label = gtk_label_new(_("Edit Buddies")); |
1 | 1983 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), editpane, label); |
1984 | |
1985 gtk_widget_show_all(notebook); | |
1986 | |
1987 /* Pack things in the vbox */ | |
1988 gtk_widget_show(vbox); | |
1989 | |
1990 | |
1991 gtk_widget_show(notebook); | |
1992 | |
1993 /* Enable buttons */ | |
1994 | |
1995 gtk_signal_connect(GTK_OBJECT(rembutton), "clicked", GTK_SIGNAL_FUNC(do_del_buddy), edittree); | |
1996 gtk_signal_connect(GTK_OBJECT(addbutton), "clicked", GTK_SIGNAL_FUNC(add_buddy_callback), NULL); | |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
1997 gtk_signal_connect(GTK_OBJECT(groupbutton), "clicked", GTK_SIGNAL_FUNC(add_group_callback), NULL); |
1 | 1998 gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0); |
1999 gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0); | |
2000 | |
2001 gtk_container_add(GTK_CONTAINER(blist), vbox); | |
2002 | |
2003 #ifndef USE_APPLET | |
2004 gtk_signal_connect(GTK_OBJECT(blist), "delete_event", GTK_SIGNAL_FUNC(do_quit), blist); | |
2005 #else | |
2006 gtk_signal_connect(GTK_OBJECT(blist), "delete_event", GTK_SIGNAL_FUNC(applet_destroy_buddy), NULL); | |
2007 #endif | |
2008 | |
2009 gtk_signal_connect(GTK_OBJECT(blist), "configure_event", GTK_SIGNAL_FUNC(move_blist_window), NULL); | |
2010 | |
2011 | |
2012 | |
2013 /* The edit tree */ | |
2014 gtk_container_add(GTK_CONTAINER(tbox), edittree); | |
2015 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(tbox), | |
2016 GTK_POLICY_NEVER,GTK_POLICY_AUTOMATIC); | |
2017 | |
2018 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2019 gtk_window_set_title(GTK_WINDOW(blist), _("Gaim - Buddy List")); |
1 | 2020 |
2021 if (general_options & OPT_GEN_SAVED_WINDOWS) { | |
2022 if (blist_pos.width != 0) { /* Sanity check! */ | |
2023 gtk_widget_set_uposition(blist, blist_pos.x - blist_pos.xoff, blist_pos.y - blist_pos.yoff); | |
2024 gtk_widget_set_usize(blist, blist_pos.width, blist_pos.height); | |
2025 } | |
2026 } | |
2027 } | |
2028 | |
2029 void refresh_buddy_window() | |
2030 { | |
2031 build_edit_tree(); | |
678
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
2032 build_permit_tree(); |
1 | 2033 |
2034 update_button_pix(); | |
2035 gtk_widget_show(blist); | |
2036 } | |
2037 |