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