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