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