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