annotate src/buddy.c @ 4327:da5e1b57adb0

[gaim-migrate @ 4583] the chatlist plugin didn't get the memo about the new grab_url parameter. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Fri, 17 Jan 2003 16:52:32 +0000
parents c5851f0e120e
children 0c68d402f59f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1 /*
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2 * gaim
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
5 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
9 * (at your option) any later version.
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
10 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
14 * GNU General Public License for more details.
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
15 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
19 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
20 */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
21
349
b402a23f35df [gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 342
diff changeset
22 #ifdef HAVE_CONFIG_H
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2048
diff changeset
23 #include <config.h>
349
b402a23f35df [gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 342
diff changeset
24 #endif
391
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
25 #ifdef GAIM_PLUGINS
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
26 #ifndef _WIN32
391
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
27 #include <dlfcn.h>
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
28 #endif
391
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
29 #endif /* GAIM_PLUGINS */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
30 #include <string.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
31 #include <stdio.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
32 #include <stdlib.h>
3159
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3154
diff changeset
33 #include <ctype.h>
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
34 #include <math.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
35 #include <time.h>
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
36 #include <ctype.h>
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
37
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
38 #ifdef _WIN32
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
39 #include <gdk/gdkwin32.h>
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
40 #else
1233
728a90516211 [gaim-migrate @ 1243]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1230
diff changeset
41 #include <unistd.h>
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
42 #include <gdk/gdkx.h>
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
43 #endif
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
44
1634
d029dc28a61e [gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1625
diff changeset
45 #include <gdk/gdkkeysyms.h>
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
46 #include <gtk/gtk.h>
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
47 #include "prpl.h"
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
48 #include "gaim.h"
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
49
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
50 #ifdef _WIN32
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
51 #include "win32dep.h"
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
52 #endif
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
53
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
54 #include "pixmaps/login_icon.xpm"
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
55 #include "pixmaps/logout_icon.xpm"
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
56 #include "pixmaps/no_icon.xpm"
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
57
1929
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
58 #include "pixmaps/away_big.xpm"
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
59
875
450db0a5bbe4 [gaim-migrate @ 885]
Rob Flynn <gaim@robflynn.com>
parents: 874
diff changeset
60 #include "pixmaps/group.xpm"
820
fe2e1ad4495b [gaim-migrate @ 830]
Rob Flynn <gaim@robflynn.com>
parents: 813
diff changeset
61
3131
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
62 #include "pixmaps/arrow_down.xpm"
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
63 #include "pixmaps/arrow_right.xpm"
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
64
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
65 static GtkTooltips *tips;
1634
d029dc28a61e [gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1625
diff changeset
66 static GtkAccelGroup *accel;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
67 static GtkWidget *editpane;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
68 static GtkWidget *buddypane;
696
97b75ed155b0 [gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 689
diff changeset
69 static GtkWidget *imchatbox;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
70 static GtkWidget *edittree;
1929
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
71 static GtkWidget *imbutton, *infobutton, *chatbutton, *awaybutton;
577
aa9a8bcddd80 [gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 544
diff changeset
72 static GtkWidget *addbutton, *groupbutton, *rembutton;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
73
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
74 GtkWidget *blist = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
75 GtkWidget *bpmenu;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
76 GtkWidget *buddies;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
77
3131
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
78 typedef struct _GtkTreePixmaps GtkTreePixmaps;
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
79
1729
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
80 struct buddy_show {
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
81 GtkWidget *item;
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
82 GtkWidget *pix;
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
83 GtkWidget *label;
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
84 GtkWidget *warn;
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
85 GtkWidget *idle;
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
86 char *name;
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
87 GSList *connlist;
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
88 guint log_timer;
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
89 gint sound;
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
90 };
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
91
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
92 /* stuff for actual display of buddy list */
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
93 struct group_show {
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
94 GtkWidget *item;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
95 GtkWidget *label;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
96 GtkWidget *tree;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
97 GSList *members;
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 };
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
100 static GSList *shows = NULL;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
101
3524
6f9610016503 [gaim-migrate @ 3597]
Sean Egan <seanegan@gmail.com>
parents: 3519
diff changeset
102 int docklet_count = 0;
3939
49d42b275a68 [gaim-migrate @ 4115]
Luke Schierer <lschiere@pidgin.im>
parents: 3902
diff changeset
103 static gboolean obscured = FALSE;
3472
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
104
2564
552a56d334ec [gaim-migrate @ 2577]
Rob Flynn <gaim@robflynn.com>
parents: 2560
diff changeset
105 /* Predefine some functions */
2569
a714b8223228 [gaim-migrate @ 2582]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2564
diff changeset
106 static void new_bp_callback(GtkWidget *w, struct buddy *bs);
1069
5d4926907b21 [gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1068
diff changeset
107 static struct group_show *find_group_show(char *group);
5d4926907b21 [gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1068
diff changeset
108 static struct buddy_show *find_buddy_show(struct group_show *gs, char *name);
5d4926907b21 [gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1068
diff changeset
109 static int group_number(char *group);
5d4926907b21 [gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1068
diff changeset
110 static int buddy_number(char *group, char *buddy);
5d4926907b21 [gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1068
diff changeset
111 static struct group_show *new_group_show(char *group);
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
112 static struct buddy_show *new_buddy_show(struct group_show *gs, struct buddy *buddy, char **xpm);
1108
cb338aa38e78 [gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
113 static void remove_buddy_show(struct group_show *gs, struct buddy_show *bs);
1069
5d4926907b21 [gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1068
diff changeset
114 static struct group_show *find_gs_by_bs(struct buddy_show *b);
1729
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
115 static void update_num_group(struct group_show *gs);
2624
4d5c2c913750 [gaim-migrate @ 2637]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2613
diff changeset
116 static void update_idle_time(struct buddy_show *bs);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
117
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
118 void handle_group_rename(struct group *g, char *prevname)
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
119 {
1729
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
120 struct group_show *gs, *new_gs;
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
121 struct buddy_show *bs;
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
122 struct buddy *b;
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
123 GSList *m;
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
124 GtkCTreeNode *c;
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
125
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
126 c = gtk_ctree_find_by_row_data(GTK_CTREE(edittree), NULL, g);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
127 gtk_ctree_node_set_text(GTK_CTREE(edittree), c, 0, g->name);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
128
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
129 gs = find_group_show(prevname);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
130 if (!gs) {
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
131 return;
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
132 }
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
133 new_gs = find_group_show(g->name);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
134 if (new_gs) {
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
135 /* transfer everything that was in gs and is in the same gaim_conn as g
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
136 * over to new_gs. */
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
137 m = gs->members;
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
138 while (m) {
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
139 bs = (struct buddy_show *)m->data;
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
140 if (g_slist_index(bs->connlist, g->gc) >= 0) {
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
141 b = find_buddy(g->gc, bs->name);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
142 m = g_slist_next(m);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
143 bs->connlist = g_slist_remove(bs->connlist, g->gc);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
144 if (!bs->connlist) {
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
145 gs->members = g_slist_remove(gs->members, bs);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
146 if (bs->log_timer > 0)
4168
ebfb80bbe1ed [gaim-migrate @ 4397]
Luke Schierer <lschiere@pidgin.im>
parents: 4167
diff changeset
147 g_source_remove(bs->log_timer);
1729
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
148 bs->log_timer = 0;
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
149 remove_buddy_show(gs, bs);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
150 g_free(bs->name);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
151 g_free(bs);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
152 }
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
153 if ((bs = find_buddy_show(new_gs, b->name)) == NULL) {
2433
cac432940fb8 [gaim-migrate @ 2446]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2393
diff changeset
154 if (g->gc->prpl->list_icon) {
1729
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
155 bs = new_buddy_show(new_gs, b,
2662
b0c5770156e1 [gaim-migrate @ 2675]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2641
diff changeset
156 g->gc->prpl->list_icon(b->uc));
1729
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
157 } else {
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
158 bs = new_buddy_show(new_gs, b, (char **)no_icon_xpm);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
159 }
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
160 }
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
161 bs->connlist = g_slist_append(bs->connlist, g->gc);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
162 } else {
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
163 m = g_slist_next(m);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
164 }
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
165 }
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
166 if (!gs->members) {
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
167 /* we just transferred all of the members out of this group_show,
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
168 * so this group_show serves no purpose now. */
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
169 shows = g_slist_remove(shows, gs);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
170 gtk_tree_remove_item(GTK_TREE(buddies), gs->item);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
171 g_free(gs->name);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
172 g_free(gs);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
173 } else {
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
174 update_num_group(gs);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
175 }
1748
2eec724fdbcd [gaim-migrate @ 1758]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1739
diff changeset
176 update_num_group(new_gs);
1729
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
177 } else {
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
178 /* two possible actions: if gs contains things that are only from g,
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
179 * just rename gs and fix the label. otherwise, move everything in g
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
180 * over to another group_show */
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
181 for (m = gs->members; m != NULL; m = g_slist_next(m)) {
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
182 bs = (struct buddy_show *)m->data;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
183 if (g_slist_index(bs->connlist, g->gc) < 0 || g_slist_length(bs->connlist) > 1) {
1729
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
184 break;
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
185 }
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
186 }
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
187 if (m) {
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
188 /* there's something from a different gaim_connection. */
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
189 new_gs = new_group_show(g->name);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
190 m = gs->members;
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
191 while (m) {
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
192 bs = (struct buddy_show *)m->data;
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
193 if (g_slist_index(bs->connlist, g->gc) >= 0) {
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
194 b = find_buddy(g->gc, bs->name);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
195 m = g_slist_next(m);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
196 bs->connlist = g_slist_remove(bs->connlist, g->gc);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
197 if (!bs->connlist) {
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
198 gs->members = g_slist_remove(gs->members, bs);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
199 if (bs->log_timer > 0)
4168
ebfb80bbe1ed [gaim-migrate @ 4397]
Luke Schierer <lschiere@pidgin.im>
parents: 4167
diff changeset
200 g_source_remove(bs->log_timer);
1729
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
201 bs->log_timer = 0;
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
202 remove_buddy_show(gs, bs);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
203 g_free(bs->name);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
204 g_free(bs);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
205 }
2433
cac432940fb8 [gaim-migrate @ 2446]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2393
diff changeset
206 if (g->gc->prpl->list_icon) {
1729
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
207 bs = new_buddy_show(new_gs, b,
2662
b0c5770156e1 [gaim-migrate @ 2675]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2641
diff changeset
208 g->gc->prpl->list_icon(b->uc));
1729
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
209 } else {
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
210 bs = new_buddy_show(new_gs, b, (char **)no_icon_xpm);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
211 }
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
212 bs->connlist = g_slist_append(NULL, g->gc);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
213 } else {
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
214 m = g_slist_next(m);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
215 }
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
216 }
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
217 update_num_group(gs);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
218 update_num_group(new_gs);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
219 } else {
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
220 g_free(gs->name);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
221 gs->name = g_strdup(g->name);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
222 update_num_group(gs);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
223 }
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
224 }
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
225 }
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
226
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
227 void handle_buddy_rename(struct buddy *b, char *prevname)
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
228 {
2787
feea7103a235 [gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2780
diff changeset
229 struct conversation *cnv;
1729
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
230 struct buddy_show *bs;
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
231 struct group_show *gs;
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
232 struct group *g;
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
233 GtkCTreeNode *c;
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
234 char buf[256];
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
235
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
236 c = gtk_ctree_find_by_row_data(GTK_CTREE(edittree), NULL, b);
4227
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
237 if (get_buddy_alias_only(b))
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
238 g_snprintf(buf, sizeof(buf), "%s (%s)", b->name, get_buddy_alias(b));
1729
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
239 else
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
240 g_snprintf(buf, sizeof(buf), "%s", b->name);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
241 gtk_ctree_node_set_text(GTK_CTREE(edittree), c, 0, buf);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
242
2787
feea7103a235 [gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2780
diff changeset
243 if ((cnv = find_conversation(b->name)) != NULL)
feea7103a235 [gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2780
diff changeset
244 set_convo_title(cnv);
feea7103a235 [gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2780
diff changeset
245
1729
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
246 g = find_group_by_buddy(b->gc, b->name);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
247 if (!g) {
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
248 /* shouldn't happen */
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
249 return;
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
250 }
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
251 gs = find_group_show(g->name);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
252 if (!gs) {
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
253 return;
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
254 }
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
255 bs = find_buddy_show(gs, prevname);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
256 if (!bs) {
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
257 /* buddy's offline */
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
258 return;
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
259 }
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
260
2275
f7bf34a3b535 [gaim-migrate @ 2285]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2255
diff changeset
261 if (g_strcasecmp(b->name, prevname)) {
1729
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
262 bs->connlist = g_slist_remove(bs->connlist, b->gc);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
263 if (!bs->connlist) {
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
264 gs->members = g_slist_remove(gs->members, bs);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
265 if (bs->log_timer > 0)
4168
ebfb80bbe1ed [gaim-migrate @ 4397]
Luke Schierer <lschiere@pidgin.im>
parents: 4167
diff changeset
266 g_source_remove(bs->log_timer);
1729
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
267 bs->log_timer = 0;
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
268 remove_buddy_show(gs, bs);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
269 g_free(bs->name);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
270 g_free(bs);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
271 }
2778
27c22147e023 [gaim-migrate @ 2791]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2736
diff changeset
272 update_num_group(gs);
1729
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
273 } else {
4227
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
274 gtk_label_set_text(GTK_LABEL(bs->label), get_buddy_alias(b));
2624
4d5c2c913750 [gaim-migrate @ 2637]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2613
diff changeset
275 update_idle_time(bs);
1729
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
276 }
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
277 }
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
278
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
279 void destroy_buddy()
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
280 {
2380
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
281 GSList *s = shows;
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
282 struct group_show *g;
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
283 GSList *m;
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
284 struct buddy_show *b;
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
285 while (s) {
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
286 g = (struct group_show *)s->data;
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
287 debug_printf("group_show still exists: %s\n", g->name);
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
288 m = g->members;
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
289 while (m) {
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
290 b = (struct buddy_show *)m->data;
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
291 debug_printf("buddy_show still exists: %s\n", b->name);
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
292 m = g_slist_remove(m, b);
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
293 if (b->log_timer > 0)
4168
ebfb80bbe1ed [gaim-migrate @ 4397]
Luke Schierer <lschiere@pidgin.im>
parents: 4167
diff changeset
294 g_source_remove(b->log_timer);
2380
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
295 b->log_timer = 0;
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
296 gtk_tree_remove_item(GTK_TREE(g->tree), b->item);
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
297 g_free(b->name);
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
298 g_free(b);
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
299 }
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
300 gtk_tree_remove_item(GTK_TREE(buddies), g->item);
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
301 s = g_slist_remove(s, g);
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
302 g_free(g->name);
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
303 g_free(g);
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
304 }
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
305 shows = NULL;
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
306
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
307 if (blist)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
308 gtk_widget_destroy(blist);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
309 blist = NULL;
700
d904bf694bd7 [gaim-migrate @ 710]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 696
diff changeset
310 imchatbox = NULL;
1544
f7bef430ccd1 [gaim-migrate @ 1554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1509
diff changeset
311 awaymenu = NULL;
f7bef430ccd1 [gaim-migrate @ 1554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1509
diff changeset
312 protomenu = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
313 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
314
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
315 static void adjust_pic(GtkWidget *button, const char *c, gchar **xpm)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
316 {
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
317 GdkPixmap *pm;
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
318 GdkBitmap *bm;
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
319 GtkWidget *pic;
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
320 GtkWidget *label;
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
321
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
322 /*if the user had opted to put pictures on the buttons */
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
323 if (blist_options & OPT_BLIST_SHOW_BUTTON_XPM && xpm) {
820
fe2e1ad4495b [gaim-migrate @ 830]
Rob Flynn <gaim@robflynn.com>
parents: 813
diff changeset
324 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, NULL, xpm);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
325 pic = gtk_pixmap_new(pm, bm);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
326 gtk_widget_show(pic);
644
b3900e312d8e [gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 608
diff changeset
327 gdk_pixmap_unref(pm);
804
17def2bb9720 [gaim-migrate @ 814]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 803
diff changeset
328 gdk_bitmap_unref(bm);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
329 label = GTK_BIN(button)->child;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
330 gtk_container_remove(GTK_CONTAINER(button), label);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
331 gtk_container_add(GTK_CONTAINER(button), pic);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
332 } else {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
333 label = gtk_label_new(c);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
334 gtk_widget_show(label);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
335 pic = GTK_BIN(button)->child;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
336 gtk_container_remove(GTK_CONTAINER(button), pic);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
337 gtk_container_add(GTK_CONTAINER(button), label);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
338 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
339
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
340 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
341
3869
061ed70be441 [gaim-migrate @ 4021]
Rob Flynn <gaim@robflynn.com>
parents: 3859
diff changeset
342 /* This will remain here until we phase out the others */
061ed70be441 [gaim-migrate @ 4021]
Rob Flynn <gaim@robflynn.com>
parents: 3859
diff changeset
343 static void adjust_pic2(GtkWidget *button, const char *c, gchar *icon)
061ed70be441 [gaim-migrate @ 4021]
Rob Flynn <gaim@robflynn.com>
parents: 3859
diff changeset
344 {
061ed70be441 [gaim-migrate @ 4021]
Rob Flynn <gaim@robflynn.com>
parents: 3859
diff changeset
345 GtkWidget *pic;
061ed70be441 [gaim-migrate @ 4021]
Rob Flynn <gaim@robflynn.com>
parents: 3859
diff changeset
346 GtkWidget *label;
061ed70be441 [gaim-migrate @ 4021]
Rob Flynn <gaim@robflynn.com>
parents: 3859
diff changeset
347
061ed70be441 [gaim-migrate @ 4021]
Rob Flynn <gaim@robflynn.com>
parents: 3859
diff changeset
348 /*if the user had opted to put pictures on the buttons */
061ed70be441 [gaim-migrate @ 4021]
Rob Flynn <gaim@robflynn.com>
parents: 3859
diff changeset
349 if (blist_options & OPT_BLIST_SHOW_BUTTON_XPM && icon) {
061ed70be441 [gaim-migrate @ 4021]
Rob Flynn <gaim@robflynn.com>
parents: 3859
diff changeset
350 label = GTK_BIN(button)->child;
061ed70be441 [gaim-migrate @ 4021]
Rob Flynn <gaim@robflynn.com>
parents: 3859
diff changeset
351 gtk_container_remove(GTK_CONTAINER(button), label);
061ed70be441 [gaim-migrate @ 4021]
Rob Flynn <gaim@robflynn.com>
parents: 3859
diff changeset
352 gtk_container_add(GTK_CONTAINER(button), gtk_image_new_from_stock(icon, GTK_ICON_SIZE_BUTTON));
061ed70be441 [gaim-migrate @ 4021]
Rob Flynn <gaim@robflynn.com>
parents: 3859
diff changeset
353 gtk_widget_show_all(button);
061ed70be441 [gaim-migrate @ 4021]
Rob Flynn <gaim@robflynn.com>
parents: 3859
diff changeset
354 } else {
061ed70be441 [gaim-migrate @ 4021]
Rob Flynn <gaim@robflynn.com>
parents: 3859
diff changeset
355 label = gtk_label_new(c);
061ed70be441 [gaim-migrate @ 4021]
Rob Flynn <gaim@robflynn.com>
parents: 3859
diff changeset
356 gtk_widget_show(label);
061ed70be441 [gaim-migrate @ 4021]
Rob Flynn <gaim@robflynn.com>
parents: 3859
diff changeset
357 pic = GTK_BIN(button)->child;
061ed70be441 [gaim-migrate @ 4021]
Rob Flynn <gaim@robflynn.com>
parents: 3859
diff changeset
358 gtk_container_remove(GTK_CONTAINER(button), pic);
061ed70be441 [gaim-migrate @ 4021]
Rob Flynn <gaim@robflynn.com>
parents: 3859
diff changeset
359 gtk_container_add(GTK_CONTAINER(button), label);
061ed70be441 [gaim-migrate @ 4021]
Rob Flynn <gaim@robflynn.com>
parents: 3859
diff changeset
360 }
061ed70be441 [gaim-migrate @ 4021]
Rob Flynn <gaim@robflynn.com>
parents: 3859
diff changeset
361
061ed70be441 [gaim-migrate @ 4021]
Rob Flynn <gaim@robflynn.com>
parents: 3859
diff changeset
362 }
061ed70be441 [gaim-migrate @ 4021]
Rob Flynn <gaim@robflynn.com>
parents: 3859
diff changeset
363
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
364
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
365 void toggle_show_empty_groups()
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
366 {
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2281
diff changeset
367 if (blist_options & OPT_BLIST_NO_MT_GRP) {
1072
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
368 /* remove any group_shows with empty members */
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
369 GSList *s = shows;
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
370 struct group_show *g;
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
371
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
372 while (s) {
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
373 g = (struct group_show *)s->data;
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
374 if (!g_slist_length(g->members)) {
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
375 shows = g_slist_remove(shows, g);
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
376 s = shows;
1108
cb338aa38e78 [gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
377 gtk_tree_remove_item(GTK_TREE(buddies), g->item);
1072
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
378 g_free(g->name);
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
379 g_free(g);
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
380 } else
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
381 s = g_slist_next(s);
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
382 }
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
383
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
384 } else {
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
385 /* put back all groups */
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
386 GSList *c = connections;
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
387 struct gaim_connection *gc;
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
388 GSList *m;
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
389 struct group *g;
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
390
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
391 while (c) {
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
392 gc = (struct gaim_connection *)c->data;
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
393 m = gc->groups;
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
394 while (m) {
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
395 g = (struct group *)m->data;
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
396 m = g_slist_next(m);
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
397 if (!find_group_show(g->name))
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
398 new_group_show(g->name);
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
399 }
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
400 c = g_slist_next(c);
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
401 }
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
402
1072
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
403 }
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
404 }
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
405
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
406 void toggle_buddy_pixmaps()
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
407 {
1711
9b86520e04ac [gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1699
diff changeset
408 GSList *s = shows;
9b86520e04ac [gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1699
diff changeset
409 struct group_show *g;
9b86520e04ac [gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1699
diff changeset
410 GSList *m;
9b86520e04ac [gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1699
diff changeset
411 struct buddy_show *b;
9b86520e04ac [gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1699
diff changeset
412
9b86520e04ac [gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1699
diff changeset
413 while (s) {
9b86520e04ac [gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1699
diff changeset
414 g = s->data;
9b86520e04ac [gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1699
diff changeset
415 m = g->members;
9b86520e04ac [gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1699
diff changeset
416 while (m) {
9b86520e04ac [gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1699
diff changeset
417 b = m->data;
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2281
diff changeset
418 if (blist_options & OPT_BLIST_SHOW_PIXMAPS)
1711
9b86520e04ac [gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1699
diff changeset
419 gtk_widget_show(b->pix);
9b86520e04ac [gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1699
diff changeset
420 else
9b86520e04ac [gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1699
diff changeset
421 gtk_widget_hide(b->pix);
9b86520e04ac [gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1699
diff changeset
422 m = m->next;
9b86520e04ac [gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1699
diff changeset
423 }
9b86520e04ac [gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1699
diff changeset
424 s = s->next;
9b86520e04ac [gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1699
diff changeset
425 }
9b86520e04ac [gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1699
diff changeset
426 }
9b86520e04ac [gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1699
diff changeset
427
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
428 static void update_num_group(struct group_show *gs)
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
429 {
1070
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
430 GSList *c = connections;
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
431 struct gaim_connection *gc;
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
432 struct group *g;
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
433 struct buddy_show *b;
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
434 int total = 0, on = 0;
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
435 char buf[256];
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
436
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
437 if (!g_slist_find(shows, gs)) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
438 debug_printf("update_num_group called for unfound group_show %s\n", gs->name);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
439 return;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
440 }
1085
8da0bf36fb99 [gaim-migrate @ 1095]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1083
diff changeset
441
1070
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
442 while (c) {
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
443 gc = (struct gaim_connection *)c->data;
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
444 g = find_group(gc, gs->name);
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
445 if (g) {
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
446 total += g_slist_length(g->members);
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
447 }
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
448 c = g_slist_next(c);
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
449 }
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
450
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
451 c = gs->members;
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
452 while (c) {
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
453 b = (struct buddy_show *)c->data;
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
454 on += g_slist_length(b->connlist);
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
455 c = g_slist_next(c);
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
456 }
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
457
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2281
diff changeset
458 if (blist_options & OPT_BLIST_SHOW_GRPNUM)
1070
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
459 g_snprintf(buf, sizeof buf, "%s (%d/%d)", gs->name, on, total);
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
460 else
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
461 g_snprintf(buf, sizeof buf, "%s", gs->name);
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
462
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
463 gtk_label_set_text(GTK_LABEL(gs->label), buf);
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
464 }
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
465
2883
c12e3e66d54a [gaim-migrate @ 2896]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2856
diff changeset
466 void update_num_groups(void)
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
467 {
1070
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
468 GSList *s = shows;
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
469 struct group_show *g;
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
470
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
471 while (s) {
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
472 g = (struct group_show *)s->data;
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
473 update_num_group(g);
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
474 s = g_slist_next(s);
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
475 }
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
476 }
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
477
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
478 void update_button_pix()
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
479 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
480
3894
36e3807e3299 [gaim-migrate @ 4046]
Rob Flynn <gaim@robflynn.com>
parents: 3885
diff changeset
481 adjust_pic2(addbutton, _("Add"), GTK_STOCK_ADD);
875
450db0a5bbe4 [gaim-migrate @ 885]
Rob Flynn <gaim@robflynn.com>
parents: 874
diff changeset
482 adjust_pic(groupbutton, _("Group"), (gchar **)group_xpm);
3894
36e3807e3299 [gaim-migrate @ 4046]
Rob Flynn <gaim@robflynn.com>
parents: 3885
diff changeset
483 adjust_pic2(rembutton, _("Remove"), GTK_STOCK_REMOVE);
875
450db0a5bbe4 [gaim-migrate @ 885]
Rob Flynn <gaim@robflynn.com>
parents: 874
diff changeset
484
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2281
diff changeset
485 if (!(blist_options & OPT_BLIST_NO_BUTTONS)) {
1963
76c862e7402f [gaim-migrate @ 1973]
Rob Flynn <gaim@robflynn.com>
parents: 1929
diff changeset
486 adjust_pic(awaybutton, _("Away"), (gchar **)away_big_xpm);
3869
061ed70be441 [gaim-migrate @ 4021]
Rob Flynn <gaim@robflynn.com>
parents: 3859
diff changeset
487 adjust_pic2(chatbutton, _("Chat"), GTK_STOCK_JUMP_TO);
061ed70be441 [gaim-migrate @ 4021]
Rob Flynn <gaim@robflynn.com>
parents: 3859
diff changeset
488 adjust_pic2(imbutton, _("IM"), GTK_STOCK_CONVERT);
061ed70be441 [gaim-migrate @ 4021]
Rob Flynn <gaim@robflynn.com>
parents: 3859
diff changeset
489 adjust_pic2(infobutton, _("Info"), GTK_STOCK_FIND);
820
fe2e1ad4495b [gaim-migrate @ 830]
Rob Flynn <gaim@robflynn.com>
parents: 813
diff changeset
490 }
544
53a85529d670 [gaim-migrate @ 554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 535
diff changeset
491 gtk_widget_hide(addbutton->parent);
53a85529d670 [gaim-migrate @ 554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 535
diff changeset
492 gtk_widget_show(addbutton->parent);
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2281
diff changeset
493 if (!(blist_options & OPT_BLIST_NO_BUTTONS)) {
696
97b75ed155b0 [gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 689
diff changeset
494 gtk_widget_hide(chatbutton->parent);
97b75ed155b0 [gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 689
diff changeset
495 gtk_widget_show(chatbutton->parent);
97b75ed155b0 [gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 689
diff changeset
496 }
820
fe2e1ad4495b [gaim-migrate @ 830]
Rob Flynn <gaim@robflynn.com>
parents: 813
diff changeset
497 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
498
3032
d3536105d581 [gaim-migrate @ 3045]
Rob Flynn <gaim@robflynn.com>
parents: 2993
diff changeset
499 void set_blist_tab()
d3536105d581 [gaim-migrate @ 3045]
Rob Flynn <gaim@robflynn.com>
parents: 2993
diff changeset
500 {
d3536105d581 [gaim-migrate @ 3045]
Rob Flynn <gaim@robflynn.com>
parents: 2993
diff changeset
501 GtkWidget *blist_notebook;
3154
a0a0b00f214b [gaim-migrate @ 3170]
Sean Egan <seanegan@gmail.com>
parents: 3152
diff changeset
502 if (!buddypane)
a0a0b00f214b [gaim-migrate @ 3170]
Sean Egan <seanegan@gmail.com>
parents: 3152
diff changeset
503 return;
a0a0b00f214b [gaim-migrate @ 3170]
Sean Egan <seanegan@gmail.com>
parents: 3152
diff changeset
504
3032
d3536105d581 [gaim-migrate @ 3045]
Rob Flynn <gaim@robflynn.com>
parents: 2993
diff changeset
505 blist_notebook = buddypane->parent; /* The "Online" Page */
d3536105d581 [gaim-migrate @ 3045]
Rob Flynn <gaim@robflynn.com>
parents: 2993
diff changeset
506
d3536105d581 [gaim-migrate @ 3045]
Rob Flynn <gaim@robflynn.com>
parents: 2993
diff changeset
507 debug_printf("blist_options = %d\n", blist_options);
d3536105d581 [gaim-migrate @ 3045]
Rob Flynn <gaim@robflynn.com>
parents: 2993
diff changeset
508 if((blist_options & OPT_BLIST_BOTTOM_TAB))
d3536105d581 [gaim-migrate @ 3045]
Rob Flynn <gaim@robflynn.com>
parents: 2993
diff changeset
509 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(blist_notebook), GTK_POS_BOTTOM);
d3536105d581 [gaim-migrate @ 3045]
Rob Flynn <gaim@robflynn.com>
parents: 2993
diff changeset
510 else
d3536105d581 [gaim-migrate @ 3045]
Rob Flynn <gaim@robflynn.com>
parents: 2993
diff changeset
511 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(blist_notebook), GTK_POS_TOP);
d3536105d581 [gaim-migrate @ 3045]
Rob Flynn <gaim@robflynn.com>
parents: 2993
diff changeset
512
d3536105d581 [gaim-migrate @ 3045]
Rob Flynn <gaim@robflynn.com>
parents: 2993
diff changeset
513 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
514
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
515
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2681
diff changeset
516 static int handle_click_group(GtkWidget *widget, GdkEventButton *event, struct group *g)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
517 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
518 if (event->type == GDK_2BUTTON_PRESS) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
519 if (GTK_TREE_ITEM(widget)->expanded)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
520 gtk_tree_item_collapse(GTK_TREE_ITEM(widget));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
521 else
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
522 gtk_tree_item_expand(GTK_TREE_ITEM(widget));
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2681
diff changeset
523 return TRUE;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
524 }
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2681
diff changeset
525
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2681
diff changeset
526 return FALSE;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
527 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
528
1739
0ddc5418a0b4 [gaim-migrate @ 1749]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
529 void pressed_im_bud(GtkWidget *widget, struct buddy *b)
0ddc5418a0b4 [gaim-migrate @ 1749]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
530 {
0ddc5418a0b4 [gaim-migrate @ 1749]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
531 struct conversation *c;
0ddc5418a0b4 [gaim-migrate @ 1749]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
532
0ddc5418a0b4 [gaim-migrate @ 1749]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
533 c = find_conversation(b->name);
0ddc5418a0b4 [gaim-migrate @ 1749]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
534
0ddc5418a0b4 [gaim-migrate @ 1749]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
535 if (c != NULL) {
0ddc5418a0b4 [gaim-migrate @ 1749]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
536 gdk_window_show(c->window->window);
0ddc5418a0b4 [gaim-migrate @ 1749]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
537 } else {
0ddc5418a0b4 [gaim-migrate @ 1749]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
538 c = new_conversation(b->name);
0ddc5418a0b4 [gaim-migrate @ 1749]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
539
1898
73d73939f698 [gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1881
diff changeset
540 set_convo_gc(c, b->gc);
1739
0ddc5418a0b4 [gaim-migrate @ 1749]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
541 }
0ddc5418a0b4 [gaim-migrate @ 1749]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
542 }
0ddc5418a0b4 [gaim-migrate @ 1749]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
543
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
544 void pressed_im(GtkWidget *widget, struct buddy_show *b)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
545 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
546 struct conversation *c;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
547
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
548 c = find_conversation(b->name);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
549
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
550 if (c != NULL) {
87
8923e3bd6c5a [gaim-migrate @ 97]
Syd Logan <slogan>
parents: 84
diff changeset
551 gdk_window_show(c->window->window);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
552 } else {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
553 c = new_conversation(b->name);
1150
aa3dda7fc352 [gaim-migrate @ 1160]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1138
diff changeset
554
1898
73d73939f698 [gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1881
diff changeset
555 set_convo_gc(c, b->connlist->data);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
556 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
557 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
558
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
559 void pressed_log(GtkWidget *widget, char *name)
1477
1d0fc2622b29 [gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1465
diff changeset
560 {
1d0fc2622b29 [gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1465
diff changeset
561 show_log(name);
1d0fc2622b29 [gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1465
diff changeset
562 }
1d0fc2622b29 [gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1465
diff changeset
563
1634
d029dc28a61e [gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1625
diff changeset
564 void show_syslog()
d029dc28a61e [gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1625
diff changeset
565 {
d029dc28a61e [gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1625
diff changeset
566 show_log(NULL);
d029dc28a61e [gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1625
diff changeset
567 }
d029dc28a61e [gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1625
diff changeset
568
1729
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
569 void pressed_alias_bs(GtkWidget *widget, struct buddy_show *bs)
710
efd72a117875 [gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 703
diff changeset
570 {
1729
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
571 alias_dialog_bud(find_buddy(bs->connlist->data, bs->name));
1397
d2799e0672ee [gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1396
diff changeset
572 }
d2799e0672ee [gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1396
diff changeset
573
d2799e0672ee [gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1396
diff changeset
574 void pressed_alias_bud(GtkWidget *widget, struct buddy *b)
d2799e0672ee [gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1396
diff changeset
575 {
d2799e0672ee [gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1396
diff changeset
576 alias_dialog_bud(b);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
577 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
578
2170
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
579 static void menu_click(GtkObject *obj, char *who)
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
580 {
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
581 GList *list = gtk_object_get_user_data(obj);
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
582 struct proto_buddy_menu *pbm = list->data;
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
583 if (pbm->callback)
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
584 pbm->callback(pbm->gc, who);
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
585 }
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
586
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2681
diff changeset
587 static int handle_click_buddy(GtkWidget *widget, GdkEventButton *event, struct buddy_show *b)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
588 {
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
589 if (!b->connlist)
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2681
diff changeset
590 return FALSE;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
591 if (event->type == GDK_2BUTTON_PRESS && event->button == 1) {
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
592 struct conversation *c;
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
593
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
594 c = find_conversation(b->name);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
595
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
596 if (c != NULL)
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
597 gdk_window_show(c->window->window);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
598 else
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
599 c = new_conversation(b->name);
1150
aa3dda7fc352 [gaim-migrate @ 1160]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1138
diff changeset
600
2132
a6b9983cead1 [gaim-migrate @ 2142]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2131
diff changeset
601 set_convo_gc(c, b->connlist->data);
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2281
diff changeset
602 if (im_options & OPT_IM_ONE_WINDOW)
1594
ac8eddd16e89 [gaim-migrate @ 1604]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1591
diff changeset
603 raise_convo_tab(c);
3568
3c4b8982068a [gaim-migrate @ 3664]
Luke Schierer <lschiere@pidgin.im>
parents: 3558
diff changeset
604 gtk_widget_grab_focus(c->entry);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
605 } else if (event->type == GDK_BUTTON_PRESS && event->button == 3) {
3251
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
606 static GtkWidget *menu = NULL;
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
607 static GList *mo_top = NULL;
1032
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
608 GtkWidget *button;
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
609 GtkWidget *menuitem;
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
610 GtkWidget *conmenu;
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
611 GSList *cn = b->connlist;
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
612 struct gaim_connection *g;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
613 /* We're gonna make us a menu right here */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
614
3251
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
615 /*
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
616 * If a menu already exists, destroy it before creating a new one,
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
617 * thus freeing-up the memory it occupied. Same for its associated
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
618 * (prpl menu items) GList.
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
619 */
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
620 if(menu) {
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
621 gtk_widget_destroy(menu);
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
622 if(mo_top) {
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
623 g_list_foreach(mo_top, (GFunc)g_free, NULL);
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
624 g_list_free(mo_top);
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
625 mo_top = NULL;
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
626 }
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
627 }
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
628
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
629 menu = gtk_menu_new();
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
630
350
fd3cc0a28d5d [gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
631 button = gtk_menu_item_new_with_label(_("IM"));
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
632 g_signal_connect(GTK_OBJECT(button), "activate", G_CALLBACK(pressed_im), b);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
633 gtk_menu_append(GTK_MENU(menu), button);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
634 gtk_widget_show(button);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
635
710
efd72a117875 [gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 703
diff changeset
636 button = gtk_menu_item_new_with_label(_("Alias"));
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
637 g_signal_connect(GTK_OBJECT(button), "activate", G_CALLBACK(pressed_alias_bs), b);
710
efd72a117875 [gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 703
diff changeset
638 gtk_menu_append(GTK_MENU(menu), button);
efd72a117875 [gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 703
diff changeset
639 gtk_widget_show(button);
efd72a117875 [gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 703
diff changeset
640
350
fd3cc0a28d5d [gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
641 button = gtk_menu_item_new_with_label(_("Add Buddy Pounce"));
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
642 g_signal_connect(GTK_OBJECT(button), "activate",
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
643 G_CALLBACK(new_bp_callback),
2569
a714b8223228 [gaim-migrate @ 2582]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2564
diff changeset
644 cn ? find_buddy(cn->data, b->name) : NULL);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
645 gtk_menu_append(GTK_MENU(menu), button);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
646 gtk_widget_show(button);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
647
1477
1d0fc2622b29 [gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1465
diff changeset
648 button = gtk_menu_item_new_with_label(_("View Log"));
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
649 g_signal_connect(GTK_OBJECT(button), "activate",
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
650 G_CALLBACK(pressed_log), b->name);
1477
1d0fc2622b29 [gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1465
diff changeset
651 gtk_menu_append(GTK_MENU(menu), button);
1d0fc2622b29 [gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1465
diff changeset
652 gtk_widget_show(button);
1d0fc2622b29 [gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1465
diff changeset
653
1032
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
654 if (g_slist_length(cn) > 1) {
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
655 while (cn) {
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
656 g = (struct gaim_connection *)cn->data;
1499
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1496
diff changeset
657 if (g->prpl->buddy_menu) {
3251
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
658 GList *mo = mo_top = g->prpl->buddy_menu(g, b->name);
2170
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
659
1032
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
660 menuitem = gtk_menu_item_new_with_label(g->username);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
661 gtk_menu_append(GTK_MENU(menu), menuitem);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
662 gtk_widget_show(menuitem);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
663
1032
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
664 conmenu = gtk_menu_new();
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
665 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), conmenu);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
666 gtk_widget_show(conmenu);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
667
2170
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
668 while (mo) {
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
669 struct proto_buddy_menu *pbm = mo->data;
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
670 GtkWidget *button;
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
671
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
672 button = gtk_menu_item_new_with_label(pbm->label);
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
673 g_signal_connect(GTK_OBJECT(button), "activate",
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
674 G_CALLBACK(menu_click), b->name);
2170
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
675 gtk_object_set_user_data(GTK_OBJECT(button), mo);
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
676 gtk_menu_append(GTK_MENU(conmenu), button);
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
677 gtk_widget_show(button);
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
678
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
679 mo = mo->next;
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
680 }
1032
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
681 }
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
682 cn = g_slist_next(cn);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
683 }
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
684 } else {
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
685 g = (struct gaim_connection *)cn->data;
2170
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
686 if (g->prpl->buddy_menu) {
3251
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
687 GList *mo = mo_top = g->prpl->buddy_menu(g, b->name);
2170
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
688
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
689 while (mo) {
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
690 struct proto_buddy_menu *pbm = mo->data;
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
691 GtkWidget *button;
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
692
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
693 button = gtk_menu_item_new_with_label(pbm->label);
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
694 g_signal_connect(GTK_OBJECT(button), "activate",
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
695 G_CALLBACK(menu_click), b->name);
2170
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
696 gtk_object_set_user_data(GTK_OBJECT(button), mo);
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
697 gtk_menu_append(GTK_MENU(menu), button);
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
698 gtk_widget_show(button);
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
699
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
700 mo = mo->next;
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
701 }
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
702 }
1032
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
703 }
1874
1e33bd2d7780 [gaim-migrate @ 1884]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1870
diff changeset
704
1e33bd2d7780 [gaim-migrate @ 1884]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1870
diff changeset
705 /* we send the menu widget so we can add menuitems within a plugin */
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3510
diff changeset
706 plugin_event(event_draw_menu, menu, b->name);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
707
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
708 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, event->button, event->time);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
709
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
710 } else if (event->type == GDK_3BUTTON_PRESS && event->button == 2) {
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
711 if (!g_strcasecmp("zilding", normalize (b->name)))
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
712 show_ee_dialog(0);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
713 else if (!g_strcasecmp("robflynn", normalize (b->name)))
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
714 show_ee_dialog(1);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
715 else if (!g_strcasecmp("flynorange", normalize (b->name)))
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
716 show_ee_dialog(2);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
717 else if (!g_strcasecmp("ewarmenhoven", normalize (b->name)))
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
718 show_ee_dialog(3);
2472
dd4114ed4c07 [gaim-migrate @ 2485]
Rob Flynn <gaim@robflynn.com>
parents: 2433
diff changeset
719 else if (!g_strcasecmp("markster97", normalize (b->name)))
dd4114ed4c07 [gaim-migrate @ 2485]
Rob Flynn <gaim@robflynn.com>
parents: 2433
diff changeset
720 show_ee_dialog(4);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2986
diff changeset
721 else if (!g_strcasecmp("seanegn", normalize (b->name)))
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2986
diff changeset
722 show_ee_dialog(5);
3043
5a459387755a [gaim-migrate @ 3056]
Rob Flynn <gaim@robflynn.com>
parents: 3033
diff changeset
723 else if (!g_strcasecmp("chipx86", normalize (b->name)))
5a459387755a [gaim-migrate @ 3056]
Rob Flynn <gaim@robflynn.com>
parents: 3033
diff changeset
724 show_ee_dialog(6);
3152
0697a3ad9f3b [gaim-migrate @ 3168]
Rob Flynn <gaim@robflynn.com>
parents: 3137
diff changeset
725 else if (!g_strcasecmp("kingant", normalize (b->name)))
0697a3ad9f3b [gaim-migrate @ 3168]
Rob Flynn <gaim@robflynn.com>
parents: 3137
diff changeset
726 show_ee_dialog(7);
3508
b8783a46e476 [gaim-migrate @ 3574]
Rob Flynn <gaim@robflynn.com>
parents: 3496
diff changeset
727 else if (!g_strcasecmp("lschiere", normalize (b->name)))
b8783a46e476 [gaim-migrate @ 3574]
Rob Flynn <gaim@robflynn.com>
parents: 3496
diff changeset
728 show_ee_dialog(8);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
729
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
730 } else {
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
731
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
732 /* Anything for other buttons? :) */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
733 }
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2681
diff changeset
734
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2681
diff changeset
735 return FALSE;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
736 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
737
1396
df7c3cacac92 [gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1392
diff changeset
738 static void un_alias(GtkWidget *a, struct buddy *b)
df7c3cacac92 [gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1392
diff changeset
739 {
4227
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
740 b->alias[0] = '\0';
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
741 handle_buddy_rename(b, b->name); /* make me a sammich! */
3136
1bd472b7f7a2 [gaim-migrate @ 3151]
Rob Flynn <gaim@robflynn.com>
parents: 3135
diff changeset
742 serv_alias_buddy(b);
4316
c5851f0e120e [gaim-migrate @ 4570]
Luke Schierer <lschiere@pidgin.im>
parents: 4280
diff changeset
743 do_export(b->gc);
1396
df7c3cacac92 [gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1392
diff changeset
744 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
745
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
746 static gboolean click_edit_tree(GtkWidget *widget, GdkEventButton *event, gpointer data)
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
747 {
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
748 GtkCTreeNode *node;
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
749 int *type;
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
750 int row, column;
3251
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
751 static GtkWidget *menu = NULL;
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
752 GtkWidget *button;
3313
b0d5ce77f7dd [gaim-migrate @ 3331]
Jim Seymour <jseymour>
parents: 3279
diff changeset
753 static GList *mo_top = NULL;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
754
1392
dc6ba774bfc5 [gaim-migrate @ 1402]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1391
diff changeset
755 if (event->button != 3 || event->type != GDK_BUTTON_PRESS)
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2681
diff changeset
756 return FALSE;
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
757
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
758 if (!gtk_clist_get_selection_info(GTK_CLIST(edittree), event->x, event->y, &row, &column))
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2681
diff changeset
759 return FALSE;
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
760
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
761 node = gtk_ctree_node_nth(GTK_CTREE(edittree), row);
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
762 type = gtk_ctree_node_get_row_data(GTK_CTREE(edittree), node);
3251
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
763
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
764 /*
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
765 * If a menu already exists, destroy it before creating a new one,
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
766 * thus freeing-up the memory it occupied.
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
767 */
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
768 if(menu) {
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
769 gtk_widget_destroy(menu);
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
770 menu = NULL; /* safety measure */
3313
b0d5ce77f7dd [gaim-migrate @ 3331]
Jim Seymour <jseymour>
parents: 3279
diff changeset
771 if(mo_top) {
b0d5ce77f7dd [gaim-migrate @ 3331]
Jim Seymour <jseymour>
parents: 3279
diff changeset
772 g_list_foreach(mo_top, (GFunc)g_free, NULL);
b0d5ce77f7dd [gaim-migrate @ 3331]
Jim Seymour <jseymour>
parents: 3279
diff changeset
773 g_list_free(mo_top);
b0d5ce77f7dd [gaim-migrate @ 3331]
Jim Seymour <jseymour>
parents: 3279
diff changeset
774 mo_top = NULL;
b0d5ce77f7dd [gaim-migrate @ 3331]
Jim Seymour <jseymour>
parents: 3279
diff changeset
775 }
3251
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
776 }
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
777
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
778 if (*type == EDIT_GROUP) {
1729
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
779 struct group *group = (struct group *)type;
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
780 menu = gtk_menu_new();
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
781
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
782 button = gtk_menu_item_new_with_label(_("Rename"));
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
783 g_signal_connect(GTK_OBJECT(button), "activate",
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
784 G_CALLBACK(show_rename_group), group);
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
785 gtk_menu_append(GTK_MENU(menu), button);
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
786 gtk_widget_show(button);
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
787
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
788 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, event->button, event->time);
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2681
diff changeset
789
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2681
diff changeset
790 return TRUE;
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
791 } else if (*type == EDIT_BUDDY) {
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
792 struct buddy *b = (struct buddy *)type;
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
793 menu = gtk_menu_new();
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
794
1739
0ddc5418a0b4 [gaim-migrate @ 1749]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
795 button = gtk_menu_item_new_with_label(_("IM"));
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
796 g_signal_connect(GTK_OBJECT(button), "activate", G_CALLBACK(pressed_im_bud), b);
1739
0ddc5418a0b4 [gaim-migrate @ 1749]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
797 gtk_menu_append(GTK_MENU(menu), button);
0ddc5418a0b4 [gaim-migrate @ 1749]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
798 gtk_widget_show(button);
0ddc5418a0b4 [gaim-migrate @ 1749]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
799
1392
dc6ba774bfc5 [gaim-migrate @ 1402]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1391
diff changeset
800 button = gtk_menu_item_new_with_label(_("Alias"));
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
801 g_signal_connect(GTK_OBJECT(button), "activate",
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
802 G_CALLBACK(pressed_alias_bud), b);
1392
dc6ba774bfc5 [gaim-migrate @ 1402]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1391
diff changeset
803 gtk_menu_append(GTK_MENU(menu), button);
dc6ba774bfc5 [gaim-migrate @ 1402]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1391
diff changeset
804 gtk_widget_show(button);
dc6ba774bfc5 [gaim-migrate @ 1402]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1391
diff changeset
805
4227
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
806 if (b->alias[0]) {
1396
df7c3cacac92 [gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1392
diff changeset
807 button = gtk_menu_item_new_with_label(_("Un-Alias"));
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
808 g_signal_connect(GTK_OBJECT(button), "activate", G_CALLBACK(un_alias), b);
1396
df7c3cacac92 [gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1392
diff changeset
809 gtk_menu_append(GTK_MENU(menu), button);
df7c3cacac92 [gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1392
diff changeset
810 gtk_widget_show(button);
df7c3cacac92 [gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1392
diff changeset
811 }
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
812
1729
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
813 button = gtk_menu_item_new_with_label(_("Rename"));
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
814 g_signal_connect(GTK_OBJECT(button), "activate",
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
815 G_CALLBACK(show_rename_buddy), b);
1729
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
816 gtk_menu_append(GTK_MENU(menu), button);
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
817 gtk_widget_show(button);
1396
df7c3cacac92 [gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1392
diff changeset
818
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
819 button = gtk_menu_item_new_with_label(_("Add Buddy Pounce"));
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
820 g_signal_connect(GTK_OBJECT(button), "activate",
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
821 G_CALLBACK(new_bp_callback), b);
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
822 gtk_menu_append(GTK_MENU(menu), button);
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
823 gtk_widget_show(button);
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
824
1477
1d0fc2622b29 [gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1465
diff changeset
825 button = gtk_menu_item_new_with_label(_("View Log"));
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
826 g_signal_connect(GTK_OBJECT(button), "activate",
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
827 G_CALLBACK(pressed_log), b->name);
1477
1d0fc2622b29 [gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1465
diff changeset
828 gtk_menu_append(GTK_MENU(menu), button);
1d0fc2622b29 [gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1465
diff changeset
829 gtk_widget_show(button);
1d0fc2622b29 [gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1465
diff changeset
830
3313
b0d5ce77f7dd [gaim-migrate @ 3331]
Jim Seymour <jseymour>
parents: 3279
diff changeset
831 /*
b0d5ce77f7dd [gaim-migrate @ 3331]
Jim Seymour <jseymour>
parents: 3279
diff changeset
832 * Add protocol-specific edit buddy menu items if they exist
b0d5ce77f7dd [gaim-migrate @ 3331]
Jim Seymour <jseymour>
parents: 3279
diff changeset
833 */
b0d5ce77f7dd [gaim-migrate @ 3331]
Jim Seymour <jseymour>
parents: 3279
diff changeset
834 if (b->gc->prpl->edit_buddy_menu) {
b0d5ce77f7dd [gaim-migrate @ 3331]
Jim Seymour <jseymour>
parents: 3279
diff changeset
835 GList *mo = mo_top = b->gc->prpl->edit_buddy_menu(b->gc, b->name);
b0d5ce77f7dd [gaim-migrate @ 3331]
Jim Seymour <jseymour>
parents: 3279
diff changeset
836
b0d5ce77f7dd [gaim-migrate @ 3331]
Jim Seymour <jseymour>
parents: 3279
diff changeset
837 while (mo) {
b0d5ce77f7dd [gaim-migrate @ 3331]
Jim Seymour <jseymour>
parents: 3279
diff changeset
838 struct proto_buddy_menu *pbm = mo->data;
b0d5ce77f7dd [gaim-migrate @ 3331]
Jim Seymour <jseymour>
parents: 3279
diff changeset
839 GtkWidget *button;
b0d5ce77f7dd [gaim-migrate @ 3331]
Jim Seymour <jseymour>
parents: 3279
diff changeset
840
b0d5ce77f7dd [gaim-migrate @ 3331]
Jim Seymour <jseymour>
parents: 3279
diff changeset
841 button = gtk_menu_item_new_with_label(pbm->label);
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
842 g_signal_connect(GTK_OBJECT(button), "activate",
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
843 G_CALLBACK(menu_click), b->name);
3313
b0d5ce77f7dd [gaim-migrate @ 3331]
Jim Seymour <jseymour>
parents: 3279
diff changeset
844 gtk_object_set_user_data(GTK_OBJECT(button), mo);
b0d5ce77f7dd [gaim-migrate @ 3331]
Jim Seymour <jseymour>
parents: 3279
diff changeset
845 gtk_menu_append(GTK_MENU(menu), button);
b0d5ce77f7dd [gaim-migrate @ 3331]
Jim Seymour <jseymour>
parents: 3279
diff changeset
846 gtk_widget_show(button);
b0d5ce77f7dd [gaim-migrate @ 3331]
Jim Seymour <jseymour>
parents: 3279
diff changeset
847
b0d5ce77f7dd [gaim-migrate @ 3331]
Jim Seymour <jseymour>
parents: 3279
diff changeset
848 mo = mo->next;
b0d5ce77f7dd [gaim-migrate @ 3331]
Jim Seymour <jseymour>
parents: 3279
diff changeset
849 }
b0d5ce77f7dd [gaim-migrate @ 3331]
Jim Seymour <jseymour>
parents: 3279
diff changeset
850 }
b0d5ce77f7dd [gaim-migrate @ 3331]
Jim Seymour <jseymour>
parents: 3279
diff changeset
851
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
852 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, event->button, event->time);
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2681
diff changeset
853
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2681
diff changeset
854 return TRUE;
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
855 }
1456
6650776468b3 [gaim-migrate @ 1466]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1435
diff changeset
856
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2681
diff changeset
857 return FALSE;
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
858 }
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
859
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
860
3059
966c4e460ebb [gaim-migrate @ 3073]
Sean Egan <seanegan@gmail.com>
parents: 3043
diff changeset
861 /*
966c4e460ebb [gaim-migrate @ 3073]
Sean Egan <seanegan@gmail.com>
parents: 3043
diff changeset
862 * Find and remove CTree node associated with buddylist entry
966c4e460ebb [gaim-migrate @ 3073]
Sean Egan <seanegan@gmail.com>
parents: 3043
diff changeset
863 */
966c4e460ebb [gaim-migrate @ 3073]
Sean Egan <seanegan@gmail.com>
parents: 3043
diff changeset
864 static void ui_remove_buddy_node(struct group *rem_g, struct buddy *rem_b)
966c4e460ebb [gaim-migrate @ 3073]
Sean Egan <seanegan@gmail.com>
parents: 3043
diff changeset
865 {
966c4e460ebb [gaim-migrate @ 3073]
Sean Egan <seanegan@gmail.com>
parents: 3043
diff changeset
866 GtkCTreeNode *gnode = NULL, *bnode;
966c4e460ebb [gaim-migrate @ 3073]
Sean Egan <seanegan@gmail.com>
parents: 3043
diff changeset
867
966c4e460ebb [gaim-migrate @ 3073]
Sean Egan <seanegan@gmail.com>
parents: 3043
diff changeset
868 if((gnode = gtk_ctree_find_by_row_data(GTK_CTREE(edittree), NULL, rem_g)) != NULL &&
966c4e460ebb [gaim-migrate @ 3073]
Sean Egan <seanegan@gmail.com>
parents: 3043
diff changeset
869 (bnode = gtk_ctree_find_by_row_data(GTK_CTREE(edittree), gnode, rem_b)) != NULL)
966c4e460ebb [gaim-migrate @ 3073]
Sean Egan <seanegan@gmail.com>
parents: 3043
diff changeset
870 {
966c4e460ebb [gaim-migrate @ 3073]
Sean Egan <seanegan@gmail.com>
parents: 3043
diff changeset
871 gtk_ctree_remove_node(GTK_CTREE(edittree), bnode);
966c4e460ebb [gaim-migrate @ 3073]
Sean Egan <seanegan@gmail.com>
parents: 3043
diff changeset
872 }
966c4e460ebb [gaim-migrate @ 3073]
Sean Egan <seanegan@gmail.com>
parents: 3043
diff changeset
873 }
966c4e460ebb [gaim-migrate @ 3073]
Sean Egan <seanegan@gmail.com>
parents: 3043
diff changeset
874
2382
569ae9f2bb89 [gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2380
diff changeset
875 void ui_remove_buddy(struct gaim_connection *gc, struct group *rem_g, struct buddy *rem_b)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
876 {
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
877 struct conversation *c;
1069
5d4926907b21 [gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1068
diff changeset
878 struct group_show *gs;
5d4926907b21 [gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1068
diff changeset
879 struct buddy_show *bs;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
880
1069
5d4926907b21 [gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1068
diff changeset
881 gs = find_group_show(rem_g->name);
5d4926907b21 [gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1068
diff changeset
882 if (gs) {
5d4926907b21 [gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1068
diff changeset
883 bs = find_buddy_show(gs, rem_b->name);
5d4926907b21 [gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1068
diff changeset
884 if (bs) {
5d4926907b21 [gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1068
diff changeset
885 if (g_slist_find(bs->connlist, gc)) {
5d4926907b21 [gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1068
diff changeset
886 bs->connlist = g_slist_remove(bs->connlist, gc);
5d4926907b21 [gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1068
diff changeset
887 if (!g_slist_length(bs->connlist)) {
5d4926907b21 [gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1068
diff changeset
888 gs->members = g_slist_remove(gs->members, bs);
5d4926907b21 [gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1068
diff changeset
889 if (bs->log_timer > 0)
4168
ebfb80bbe1ed [gaim-migrate @ 4397]
Luke Schierer <lschiere@pidgin.im>
parents: 4167
diff changeset
890 g_source_remove(bs->log_timer);
1098
b335c0ce305e [gaim-migrate @ 1108]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1097
diff changeset
891 bs->log_timer = 0;
1108
cb338aa38e78 [gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
892 remove_buddy_show(gs, bs);
1069
5d4926907b21 [gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1068
diff changeset
893 g_free(bs->name);
5d4926907b21 [gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1068
diff changeset
894 g_free(bs);
1083
12478dd1e9d7 [gaim-migrate @ 1093]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1081
diff changeset
895 if (!g_slist_length(gs->members) &&
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
896 (blist_options & OPT_BLIST_NO_MT_GRP)) {
1069
5d4926907b21 [gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1068
diff changeset
897 shows = g_slist_remove(shows, gs);
1108
cb338aa38e78 [gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
898 gtk_tree_remove_item(GTK_TREE(buddies), gs->item);
1069
5d4926907b21 [gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1068
diff changeset
899 g_free(gs->name);
5d4926907b21 [gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1068
diff changeset
900 g_free(gs);
3134
c05990414e2e [gaim-migrate @ 3149]
Rob Flynn <gaim@robflynn.com>
parents: 3133
diff changeset
901 gs = NULL;
2778
27c22147e023 [gaim-migrate @ 2791]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2736
diff changeset
902 }
27c22147e023 [gaim-migrate @ 2791]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2736
diff changeset
903 }
27c22147e023 [gaim-migrate @ 2791]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2736
diff changeset
904 }
27c22147e023 [gaim-migrate @ 2791]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2736
diff changeset
905 }
3103
0f54285a2271 [gaim-migrate @ 3117]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
906 if (gs)
0f54285a2271 [gaim-migrate @ 3117]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
907 update_num_group(gs);
1069
5d4926907b21 [gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1068
diff changeset
908 }
5d4926907b21 [gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1068
diff changeset
909
2382
569ae9f2bb89 [gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2380
diff changeset
910 c = find_conversation(rem_b->name);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
911 if (c)
1352
2e8213567278 [gaim-migrate @ 1362]
Rob Flynn <gaim@robflynn.com>
parents: 1340
diff changeset
912 update_buttons_by_protocol(c);
3059
966c4e460ebb [gaim-migrate @ 3073]
Sean Egan <seanegan@gmail.com>
parents: 3043
diff changeset
913
966c4e460ebb [gaim-migrate @ 3073]
Sean Egan <seanegan@gmail.com>
parents: 3043
diff changeset
914 /* Remove CTree node for buddy */
966c4e460ebb [gaim-migrate @ 3073]
Sean Egan <seanegan@gmail.com>
parents: 3043
diff changeset
915 ui_remove_buddy_node(rem_g, rem_b);
966c4e460ebb [gaim-migrate @ 3073]
Sean Egan <seanegan@gmail.com>
parents: 3043
diff changeset
916
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
917 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
918
2382
569ae9f2bb89 [gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2380
diff changeset
919 void ui_remove_group(struct gaim_connection *gc, struct group *rem_g)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
920 {
1297
aa6a0fe8e03f [gaim-migrate @ 1307]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
921 struct group_show *gs;
2382
569ae9f2bb89 [gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2380
diff changeset
922
569ae9f2bb89 [gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2380
diff changeset
923 if ((gs = find_group_show(rem_g->name)) != NULL) {
1465
163b9ee8d789 [gaim-migrate @ 1475]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1456
diff changeset
924 shows = g_slist_remove(shows, gs);
1297
aa6a0fe8e03f [gaim-migrate @ 1307]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
925 gtk_tree_remove_item(GTK_TREE(buddies), gs->item);
aa6a0fe8e03f [gaim-migrate @ 1307]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
926 g_free(gs->name);
aa6a0fe8e03f [gaim-migrate @ 1307]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
927 g_free(gs);
aa6a0fe8e03f [gaim-migrate @ 1307]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
928 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
929 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
930
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
931 gboolean edit_drag_compare_func(GtkCTree *ctree, GtkCTreeNode *source_node,
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
932 GtkCTreeNode *new_parent, GtkCTreeNode *new_sibling)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
933 {
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
934 int *type;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
935
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
936 type = (int *)gtk_ctree_node_get_row_data(GTK_CTREE(ctree), source_node);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
937
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
938 if (*type == EDIT_GC) {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
939 if (!new_parent)
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
940 return TRUE;
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
941 } else if (*type == EDIT_BUDDY) {
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
942 if (new_parent) {
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
943 type = (int *)gtk_ctree_node_get_row_data(GTK_CTREE(ctree), new_parent);
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
944 if (*type == EDIT_GROUP)
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
945 return TRUE;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
946 }
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
947 } else { /* group */
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
948
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
949 if (g_slist_length(connections) > 1 && new_parent) {
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
950 type = (int *)gtk_ctree_node_get_row_data(GTK_CTREE(ctree), new_parent);
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
951 if (*type == EDIT_GC)
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
952 return TRUE;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
953 } else if (g_slist_length(connections) == 1 && !new_parent)
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
954 return TRUE;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
955 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
956
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
957 return FALSE;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
958 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
959
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
960
2380
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
961 /* you really shouldn't call this function */
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
962 void redo_buddy_list()
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
963 {
1069
5d4926907b21 [gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1068
diff changeset
964 /* so here we can safely assume that we don't have to add or delete anything, we
5d4926907b21 [gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1068
diff changeset
965 * just have to go through and reorder everything. remember, nothing is going to
5d4926907b21 [gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1068
diff changeset
966 * change connections, so we can assume that we don't have to change any user
5d4926907b21 [gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1068
diff changeset
967 * data or anything. this is just a simple reordering. so calm down. */
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
968 /* note: we only have to do this if we want to strongly enforce order; however,
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
969 * order doesn't particularly matter to the stability of the program. but, it's
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
970 * kind of nice to have */
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
971 /* the easy way to implement this is just to go through shows and destroy all the
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
972 * group_shows, then go through the connections and put everything back. though,
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
973 * there are slight complications with that; most of them deal with timeouts and
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
974 * people not seeing the login icon for the full 10 seconds. butt fuck them. */
1069
5d4926907b21 [gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1068
diff changeset
975 GSList *s = shows;
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
976 struct group_show *gs;
1069
5d4926907b21 [gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1068
diff changeset
977 GSList *m;
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
978 struct buddy_show *bs;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
979 GSList *c = connections;
1069
5d4926907b21 [gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1068
diff changeset
980 struct gaim_connection *gc;
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
981 GSList *gr;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
982 struct group *g;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
983 struct buddy *b;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
984
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
985 if (!blist)
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
986 return;
1150
aa3dda7fc352 [gaim-migrate @ 1160]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1138
diff changeset
987
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
988 while (s) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
989 gs = (struct group_show *)s->data;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
990 s = g_slist_remove(s, gs);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
991 m = gs->members;
1108
cb338aa38e78 [gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
992 gtk_tree_remove_item(GTK_TREE(buddies), gs->item);
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
993 while (m) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
994 bs = (struct buddy_show *)m->data;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
995 m = g_slist_remove(m, bs);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
996 if (bs->log_timer > 0)
4168
ebfb80bbe1ed [gaim-migrate @ 4397]
Luke Schierer <lschiere@pidgin.im>
parents: 4167
diff changeset
997 g_source_remove(bs->log_timer);
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
998 g_free(bs->name);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
999 g_free(bs);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1000 }
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1001 g_free(gs->name);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1002 g_free(gs);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1003 }
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1004 shows = NULL;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1005 while (c) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1006 gc = (struct gaim_connection *)c->data;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1007 c = c->next;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1008 gr = gc->groups;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1009 while (gr) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1010 g = (struct group *)gr->data;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1011 gr = gr->next;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1012 gs = find_group_show(g->name);
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2281
diff changeset
1013 if (!gs && !(blist_options & OPT_BLIST_NO_MT_GRP))
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1014 gs = new_group_show(g->name);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1015 m = g->members;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1016 while (m) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1017 b = (struct buddy *)m->data;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1018 m = m->next;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1019 if (b->present) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1020 if (!gs)
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1021 gs = new_group_show(g->name);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1022 bs = find_buddy_show(gs, b->name);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1023 if (!bs) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1024 if (gc->prpl->list_icon)
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1025 bs = new_buddy_show(gs, b,
2662
b0c5770156e1 [gaim-migrate @ 2675]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2641
diff changeset
1026 gc->prpl->list_icon(b->
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1027 uc));
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1028 else
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1029 bs = new_buddy_show(gs, b, (char **)no_icon_xpm);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1030 }
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1031 bs->connlist = g_slist_append(bs->connlist, gc);
2778
27c22147e023 [gaim-migrate @ 2791]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2736
diff changeset
1032 update_num_group(gs);
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1033 }
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1034 }
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1035 }
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1036 }
2605
ff9d9b4f7aa2 [gaim-migrate @ 2618]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2598
diff changeset
1037 update_idle_times();
1069
5d4926907b21 [gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1068
diff changeset
1038 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1039
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1040 static void edit_tree_move(GtkCTree *ctree, GtkCTreeNode *child, GtkCTreeNode *parent,
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1041 GtkCTreeNode *sibling, gpointer data)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1042 {
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1043 struct gaim_connection *gc, *pc = NULL, *sc = NULL;
1456
6650776468b3 [gaim-migrate @ 1466]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1435
diff changeset
1044 int *ctype, *ptype = NULL, *stype = NULL;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1045
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1046 ctype = (int *)gtk_ctree_node_get_row_data(GTK_CTREE(ctree), child);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1047
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1048 if (parent)
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1049 ptype = (int *)gtk_ctree_node_get_row_data(GTK_CTREE(ctree), parent);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1050
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1051 if (sibling)
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1052 stype = (int *)gtk_ctree_node_get_row_data(GTK_CTREE(ctree), sibling);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1053
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1054 if (*ctype == EDIT_GC) {
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1055 /* not that it particularly matters which order the connections
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1056 * are in, but just for debugging sake, i guess.... */
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1057 gc = (struct gaim_connection *)ctype;
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1058 connections = g_slist_remove(connections, gc);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1059 if (sibling) {
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1060 int pos;
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1061 sc = (struct gaim_connection *)stype;
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1062 pos = g_slist_index(connections, sc);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1063 if (pos)
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1064 connections = g_slist_insert(connections, gc, pos);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1065 else
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1066 connections = g_slist_prepend(connections, gc);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1067 } else
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1068 connections = g_slist_append(connections, gc);
2641
671c3a6a2c12 [gaim-migrate @ 2654]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2624
diff changeset
1069 redo_convo_menus(); /* this is evil */
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1070 } else if (*ctype == EDIT_BUDDY) {
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1071 /* 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
1072 * 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
1073 * 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
1074 * we change the group that the buddy is in */
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1075 struct group *old_g, *new_g = (struct group *)ptype;
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1076 struct buddy *s = NULL, *buddy = (struct buddy *)ctype;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2669
diff changeset
1077 gboolean add = FALSE;
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1078 int pos;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1079
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1080 if (buddy->gc != new_g->gc) {
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1081 /* we changed connections */
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1082 struct buddy *a;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1083
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1084 a = find_buddy(new_g->gc, buddy->name);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1085
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1086 if (a) {
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1087 /* 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
1088 * its current group and add it to the proper group below */
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1089 struct group *og;
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1090 og = find_group_by_buddy(new_g->gc, buddy->name);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1091 og->members = g_slist_remove(og->members, a);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1092 } else {
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1093 /* we don't have this buddy yet; let's add him */
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2669
diff changeset
1094 add = TRUE;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1095 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1096 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1097
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1098 old_g = find_group_by_buddy(buddy->gc, buddy->name);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1099
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1100 if (buddy->gc == new_g->gc)
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1101 /* this is the same connection, so we'll remove it from its old group */
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1102 old_g->members = g_slist_remove(old_g->members, buddy);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1103
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1104 if (sibling) {
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1105 s = (struct buddy *)stype;
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1106 pos = g_slist_index(new_g->members, s);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1107 if (pos)
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1108 new_g->members = g_slist_insert(new_g->members, buddy, pos);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1109 else
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1110 new_g->members = g_slist_prepend(new_g->members, buddy);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1111 } else
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1112 new_g->members = g_slist_append(new_g->members, buddy);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1113
3136
1bd472b7f7a2 [gaim-migrate @ 3151]
Rob Flynn <gaim@robflynn.com>
parents: 3135
diff changeset
1114 /*
1bd472b7f7a2 [gaim-migrate @ 3151]
Rob Flynn <gaim@robflynn.com>
parents: 3135
diff changeset
1115 * we do the add after it's added locally so that prpls can find it if necessary
1bd472b7f7a2 [gaim-migrate @ 3151]
Rob Flynn <gaim@robflynn.com>
parents: 3135
diff changeset
1116 * JFIXME: Er, shouldn't the buddy be removed from the old server, as well?
1bd472b7f7a2 [gaim-migrate @ 3151]
Rob Flynn <gaim@robflynn.com>
parents: 3135
diff changeset
1117 */
1bd472b7f7a2 [gaim-migrate @ 3151]
Rob Flynn <gaim@robflynn.com>
parents: 3135
diff changeset
1118 if (add) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2669
diff changeset
1119 serv_add_buddy(new_g->gc, buddy->name);
3136
1bd472b7f7a2 [gaim-migrate @ 3151]
Rob Flynn <gaim@robflynn.com>
parents: 3135
diff changeset
1120 } else {
1bd472b7f7a2 [gaim-migrate @ 3151]
Rob Flynn <gaim@robflynn.com>
parents: 3135
diff changeset
1121 serv_move_buddy(buddy, old_g, new_g);
1bd472b7f7a2 [gaim-migrate @ 3151]
Rob Flynn <gaim@robflynn.com>
parents: 3135
diff changeset
1122 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2669
diff changeset
1123
1805
caa605e70917 [gaim-migrate @ 1815]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1794
diff changeset
1124 do_export(buddy->gc);
caa605e70917 [gaim-migrate @ 1815]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1794
diff changeset
1125 if (buddy->gc != new_g->gc) {
caa605e70917 [gaim-migrate @ 1815]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1794
diff changeset
1126 do_export(new_g->gc);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1127 build_edit_tree();
1805
caa605e70917 [gaim-migrate @ 1815]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1794
diff changeset
1128 }
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1129 } else { /* group */
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1130
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1131 /* 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
1132 * group. if the buddy exists in the new connection, leave it where it is. */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1133
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1134 struct group *g, *g2, *group;
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1135 int pos;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1136
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1137 pc = (struct gaim_connection *)ptype;
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1138 group = (struct group *)ctype;
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1139
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1140 if (g_slist_length(connections) > 1) {
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1141 g = find_group(pc, group->name);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1142 if (!g)
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1143 g = add_group(pc, group->name);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1144
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1145 pc->groups = g_slist_remove(pc->groups, g);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1146
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1147 if (sibling) {
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1148 g2 = (struct group *)stype;
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1149 pos = g_slist_index(pc->groups, g2);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1150 if (pos)
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1151 pc->groups = g_slist_insert(pc->groups, g, pos);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1152 else
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1153 pc->groups = g_slist_prepend(pc->groups, g);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1154 } else
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1155 pc->groups = g_slist_append(pc->groups, g);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1156
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1157 if (pc != group->gc) {
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1158 GSList *mem;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1159 struct buddy *b;
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1160 g2 = group;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1161
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1162 mem = g2->members;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1163 while (mem) {
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1164 b = (struct buddy *)mem->data;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1165 if (!find_buddy(pc, b->name))
4227
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
1166 add_buddy(pc, g->name, b->name, b->alias);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1167 mem = mem->next;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1168 }
912
5a517b4f0be4 [gaim-migrate @ 922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 905
diff changeset
1169 }
1805
caa605e70917 [gaim-migrate @ 1815]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1794
diff changeset
1170 do_export(pc);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1171 } else {
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1172 g = group;
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1173 gc = g->gc;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1174
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1175 gc->groups = g_slist_remove(gc->groups, g);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1176
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1177 if (sibling) {
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1178 g2 = (struct group *)stype;
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1179 pos = g_slist_index(gc->groups, g2);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1180 if (pos)
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1181 gc->groups = g_slist_insert(gc->groups, g, pos);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1182 else
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1183 gc->groups = g_slist_prepend(gc->groups, g);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1184 } else
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1185 gc->groups = g_slist_append(gc->groups, g);
1805
caa605e70917 [gaim-migrate @ 1815]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1794
diff changeset
1186 do_export(gc);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1187 }
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1188 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1189
1069
5d4926907b21 [gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1068
diff changeset
1190 redo_buddy_list();
1070
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
1191 update_num_groups();
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1192 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1193
3111
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1194 void
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1195 create_prpl_icon(GtkWidget *widget, struct gaim_connection *gc,
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1196 GdkPixmap **pixmap, GdkBitmap **mask)
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1197 {
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1198 /* This whole thing is a hack--but it looks nice.
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1199 * Probably should have a prpl->icon(struct gaim_connection *) to
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1200 * do this. */
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1201 GtkStyle *style;
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1202 char **xpm = NULL;
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1203
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1204 if (widget == NULL || gc == NULL || pixmap == NULL || mask == NULL)
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1205 return;
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1206
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1207 style = gtk_widget_get_style( widget );
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1208
3159
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3154
diff changeset
1209 if (gc->prpl->list_icon) {
3111
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1210 if (gc->prpl->protocol == PROTO_OSCAR) {
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1211 if (isdigit(*gc->username)) {
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1212 xpm = gc->prpl->list_icon(0);
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1213 } else {
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1214 xpm = gc->prpl->list_icon(0x10);
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1215 }
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1216 } else {
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1217 xpm = gc->prpl->list_icon (0);
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1218 }
3159
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3154
diff changeset
1219 }
3111
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1220 if (xpm == NULL)
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1221 xpm = (char **)no_icon_xpm;
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1222
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1223 *pixmap = gdk_pixmap_create_from_xpm_d(widget->window, mask, &style->bg[GTK_STATE_NORMAL], xpm);
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1224 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1225
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1226 void build_edit_tree()
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1227 {
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1228 GtkCTreeNode *c = NULL, *p = NULL, *n;
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1229 GSList *con = connections;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1230 GSList *grp;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1231 GSList *mem;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1232 struct gaim_connection *z;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1233 struct group *g;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1234 struct buddy *b;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1235 char *text[1];
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1236
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1237 if (!blist)
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1238 return;
1032
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
1239
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1240 gtk_clist_freeze(GTK_CLIST(edittree));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1241 gtk_clist_clear(GTK_CLIST(edittree));
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1242
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1243
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1244 while (con) {
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1245 z = (struct gaim_connection *)con->data;
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 if (g_slist_length(connections) > 1) {
3111
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1248 GdkPixmap *pixmap;
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1249 GdkBitmap *mask;
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1250
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1251 text[0] = z->username;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1252
3111
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1253 create_prpl_icon(blist, z, &pixmap, &mask);
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1254
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1255 c = gtk_ctree_insert_node(GTK_CTREE(edittree), NULL,
3111
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1256 NULL, text, 3, pixmap, mask, pixmap, mask, 0, 1);
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1257
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1258 gdk_pixmap_unref (pixmap);
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1259 gdk_bitmap_unref (mask);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1260
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1261 gtk_ctree_node_set_row_data(GTK_CTREE(edittree), c, z);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1262 } else
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1263 c = NULL;
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 grp = z->groups;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1266
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1267 while (grp) {
3111
319a66fc131f [gaim-migrate @ 3125]
Sean Egan <seanegan@gmail.com>
parents: 3104
diff changeset
1268
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1269 g = (struct group *)grp->data;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1270
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1271 text[0] = g->name;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1272
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1273 p = gtk_ctree_insert_node(GTK_CTREE(edittree), c,
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1274 NULL, text, 5, NULL, NULL, NULL, NULL, 0, 1);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1275
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1276 gtk_ctree_node_set_row_data(GTK_CTREE(edittree), p, g);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1277
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1278 n = NULL;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1279
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1280 mem = g->members;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1281
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1282 while (mem) {
1396
df7c3cacac92 [gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1392
diff changeset
1283 char buf[256];
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1284 b = (struct buddy *)mem->data;
4227
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
1285 if (get_buddy_alias_only(b)) {
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
1286 g_snprintf(buf, sizeof(buf), "%s (%s)", b->name, get_buddy_alias(b));
1396
df7c3cacac92 [gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1392
diff changeset
1287 text[0] = buf;
df7c3cacac92 [gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1392
diff changeset
1288 } else
df7c3cacac92 [gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1392
diff changeset
1289 text[0] = b->name;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1290
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1291 n = gtk_ctree_insert_node(GTK_CTREE(edittree),
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1292 p, NULL, text, 5,
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1293 NULL, NULL, NULL, NULL, 1, 1);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1294
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1295 gtk_ctree_node_set_row_data(GTK_CTREE(edittree), n, b);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1296
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1297 mem = mem->next;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1298
1030
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 grp = g_slist_next(grp);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1301 }
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1302 con = g_slist_next(con);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1303 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1304
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1305 gtk_clist_thaw(GTK_CLIST(edittree));
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1306
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1307 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1308
2382
569ae9f2bb89 [gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2380
diff changeset
1309 void ui_add_buddy(struct gaim_connection *gc, struct group *g, struct buddy *b)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1310 {
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1311 GtkCTreeNode *p = NULL, *n;
1699
644056e095f1 [gaim-migrate @ 1709]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1694
diff changeset
1312 char *text[1];
644056e095f1 [gaim-migrate @ 1709]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1694
diff changeset
1313 char buf[256];
2382
569ae9f2bb89 [gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2380
diff changeset
1314 struct group_show *gs = find_group_show(g->name);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1315
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1316 b->edittype = EDIT_BUDDY;
1088
18a14e6dd0af [gaim-migrate @ 1098]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1085
diff changeset
1317
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1318 if (gs)
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1319 update_num_group(gs);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1320
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1321 if (!blist)
2382
569ae9f2bb89 [gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2380
diff changeset
1322 return;
1699
644056e095f1 [gaim-migrate @ 1709]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1694
diff changeset
1323
644056e095f1 [gaim-migrate @ 1709]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1694
diff changeset
1324 p = gtk_ctree_find_by_row_data(GTK_CTREE(edittree), NULL, g);
4227
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
1325 if (get_buddy_alias_only(b)) {
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
1326 g_snprintf(buf, sizeof(buf), "%s (%s)", b->name, get_buddy_alias(b));
1699
644056e095f1 [gaim-migrate @ 1709]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1694
diff changeset
1327 text[0] = buf;
644056e095f1 [gaim-migrate @ 1709]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1694
diff changeset
1328 } else
644056e095f1 [gaim-migrate @ 1709]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1694
diff changeset
1329 text[0] = b->name;
644056e095f1 [gaim-migrate @ 1709]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1694
diff changeset
1330
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1331 n = gtk_ctree_insert_node(GTK_CTREE(edittree), p, NULL, text, 5, NULL, NULL, NULL, NULL, 1, 1);
1699
644056e095f1 [gaim-migrate @ 1709]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1694
diff changeset
1332 gtk_ctree_node_set_row_data(GTK_CTREE(edittree), n, b);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1333 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1334
2382
569ae9f2bb89 [gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2380
diff changeset
1335 void ui_add_group(struct gaim_connection *gc, struct group *g)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1336 {
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1337 GtkCTreeNode *c = NULL, *p;
1663
0f7d2284296f [gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1662
diff changeset
1338 char *text[1];
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1339
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1340 g->edittype = EDIT_GROUP;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1341
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1342 if (!blist)
2382
569ae9f2bb89 [gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2380
diff changeset
1343 return;
1088
18a14e6dd0af [gaim-migrate @ 1098]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1085
diff changeset
1344
1663
0f7d2284296f [gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1662
diff changeset
1345 c = gtk_ctree_find_by_row_data(GTK_CTREE(edittree), NULL, gc);
0f7d2284296f [gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1662
diff changeset
1346 text[0] = g->name;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1347 p = gtk_ctree_insert_node(GTK_CTREE(edittree), c, NULL, text, 5, NULL, NULL, NULL, NULL, 0, 1);
1663
0f7d2284296f [gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1662
diff changeset
1348 gtk_ctree_node_set_row_data(GTK_CTREE(edittree), p, g);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1349
2382
569ae9f2bb89 [gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2380
diff changeset
1350 if (!(blist_options & OPT_BLIST_NO_MT_GRP) && !find_group_show(g->name))
569ae9f2bb89 [gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2380
diff changeset
1351 new_group_show(g->name);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1352 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1353
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1354
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1355 static void do_del_buddy(GtkWidget *w, GtkCTree *ctree)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1356 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1357 GtkCTreeNode *node;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1358 struct buddy *b;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1359 struct group *g;
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1360 int *type;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1361 GList *i;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1362
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1363 i = GTK_CLIST(edittree)->selection;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1364 if (i) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1365 node = i->data;
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1366 type = (int *)gtk_ctree_node_get_row_data(GTK_CTREE(edittree), node);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1367
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1368 if (*type == EDIT_BUDDY) {
1821
5fc89f9e7f3e [gaim-migrate @ 1831]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1817
diff changeset
1369 struct gaim_connection *gct;
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1370 b = (struct buddy *)type;
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1371 g = find_group_by_buddy(b->gc, b->name);
1821
5fc89f9e7f3e [gaim-migrate @ 1831]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1817
diff changeset
1372 gct = b->gc;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2669
diff changeset
1373 serv_remove_buddy(b->gc, b->name, g->name);
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1374 remove_buddy(b->gc, g, b);
1821
5fc89f9e7f3e [gaim-migrate @ 1831]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1817
diff changeset
1375 do_export(gct);
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1376 } else if (*type == EDIT_GROUP) {
1825
b96f07ff3f78 [gaim-migrate @ 1835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1821
diff changeset
1377 struct gaim_connection *gc = ((struct group *)type)->gc;
b96f07ff3f78 [gaim-migrate @ 1835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1821
diff changeset
1378 remove_group(gc, (struct group *)type);
1662
88e72116639d [gaim-migrate @ 1672]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1661
diff changeset
1379 gtk_ctree_remove_node(GTK_CTREE(edittree), node);
1825
b96f07ff3f78 [gaim-migrate @ 1835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1821
diff changeset
1380 do_export(gc);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1381 }
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1382
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1383 } else {
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1384 /* Nothing selected. */
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1385 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1386 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1387
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1388
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1389 void import_callback(GtkWidget *widget, void *null)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1390 {
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1391 show_import_dialog();
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1392 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1393
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1394 void add_buddy_callback(GtkWidget *widget, void *dummy)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1395 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1396 char *grp = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1397 GtkCTreeNode *node;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1398 GList *i;
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1399 struct gaim_connection *gc = NULL;
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1400 int *type;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1401
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1402 i = GTK_CLIST(edittree)->selection;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1403 if (i) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1404 node = i->data;
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1405 type = (int *)gtk_ctree_node_get_row_data(GTK_CTREE(edittree), node);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1406
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1407 if (*type == EDIT_BUDDY) {
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1408 struct buddy *b = (struct buddy *)type;
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1409 struct group *g = find_group_by_buddy(b->gc, b->name);
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1410 grp = g->name;
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1411 gc = b->gc;
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1412 } else if (*type == EDIT_GROUP) {
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1413 struct group *g = (struct group *)type;
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1414 grp = g->name;
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1415 gc = g->gc;
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1416 } else {
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1417 gc = (struct gaim_connection *)type;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1418 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1419 }
2582
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2569
diff changeset
1420 show_add_buddy(gc, NULL, grp, NULL);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1421
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1422 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1423
577
aa9a8bcddd80 [gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 544
diff changeset
1424 void add_group_callback(GtkWidget *widget, void *dummy)
aa9a8bcddd80 [gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 544
diff changeset
1425 {
1072
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
1426 GtkCTreeNode *node;
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
1427 GList *i;
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
1428 struct gaim_connection *gc = NULL;
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1429 int *type;
1072
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
1430
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
1431 i = GTK_CLIST(edittree)->selection;
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
1432 if (i) {
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
1433 node = i->data;
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1434 type = (int *)gtk_ctree_node_get_row_data(GTK_CTREE(edittree), node);
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1435 if (*type == EDIT_BUDDY)
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1436 gc = ((struct buddy *)type)->gc;
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1437 else if (*type == EDIT_GROUP)
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1438 gc = ((struct group *)type)->gc;
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1439 else
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
1440 gc = (struct gaim_connection *)type;
1072
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
1441 }
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
1442 show_add_group(gc);
577
aa9a8bcddd80 [gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 544
diff changeset
1443 }
aa9a8bcddd80 [gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 544
diff changeset
1444
935
5e6ca3dd4d02 [gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 921
diff changeset
1445 static void im_callback(GtkWidget *widget, GtkTree *tree)
5e6ca3dd4d02 [gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 921
diff changeset
1446 {
5e6ca3dd4d02 [gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 921
diff changeset
1447 GList *i;
1032
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
1448 struct buddy_show *b = NULL;
935
5e6ca3dd4d02 [gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 921
diff changeset
1449 struct conversation *c;
3466
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1450 i = GTK_TREE_SELECTION_OLD(tree);
935
5e6ca3dd4d02 [gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 921
diff changeset
1451 if (i) {
5e6ca3dd4d02 [gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 921
diff changeset
1452 b = gtk_object_get_user_data(GTK_OBJECT(i->data));
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1453 }
1095
ca8206682e3f [gaim-migrate @ 1105]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1092
diff changeset
1454 if (!i || !b) {
935
5e6ca3dd4d02 [gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 921
diff changeset
1455 show_im_dialog();
5e6ca3dd4d02 [gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 921
diff changeset
1456 return;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1457 }
935
5e6ca3dd4d02 [gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 921
diff changeset
1458 if (!b->name)
5e6ca3dd4d02 [gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 921
diff changeset
1459 return;
5e6ca3dd4d02 [gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 921
diff changeset
1460
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1461 c = find_conversation(b->name);
935
5e6ca3dd4d02 [gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 921
diff changeset
1462 if (c == NULL) {
5e6ca3dd4d02 [gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 921
diff changeset
1463 c = new_conversation(b->name);
5e6ca3dd4d02 [gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 921
diff changeset
1464 } else {
5e6ca3dd4d02 [gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 921
diff changeset
1465 gdk_window_raise(c->window->window);
5e6ca3dd4d02 [gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 921
diff changeset
1466 }
2886
9571d6794ef3 [gaim-migrate @ 2899]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2883
diff changeset
1467
9571d6794ef3 [gaim-migrate @ 2899]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2883
diff changeset
1468 set_convo_gc(c, b->connlist->data);
935
5e6ca3dd4d02 [gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 921
diff changeset
1469 }
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1470
935
5e6ca3dd4d02 [gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 921
diff changeset
1471
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1472 static void info_callback(GtkWidget *widget, GtkTree *tree)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1473 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1474 GList *i;
1032
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
1475 struct buddy_show *b = NULL;
3466
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1476 i = GTK_TREE_SELECTION_OLD(tree);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1477 if (i) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1478 b = gtk_object_get_user_data(GTK_OBJECT(i->data));
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1479 }
1095
ca8206682e3f [gaim-migrate @ 1105]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1092
diff changeset
1480 if (!i || !b) {
935
5e6ca3dd4d02 [gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 921
diff changeset
1481 show_info_dialog();
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1482 return;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1483 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1484 if (!b->name)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1485 return;
1693
6ccd49e6f24c [gaim-migrate @ 1703]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1681
diff changeset
1486 if (b->connlist)
6ccd49e6f24c [gaim-migrate @ 1703]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1681
diff changeset
1487 serv_get_info(b->connlist->data, b->name);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1488 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1489
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1490
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1491 void chat_callback(GtkWidget *widget, GtkTree *tree)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1492 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1493 join_chat();
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1494 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1495
1929
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
1496 static void away_callback(GtkWidget *widget, GtkTree *tree)
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
1497 {
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
1498 GSList *awy = away_messages;
3251
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
1499 static GtkWidget *menu = NULL;
1929
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
1500 GtkWidget *menuitem;
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
1501
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
1502 if (!awy)
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
1503 return;
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
1504
3251
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
1505 /*
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
1506 * If a menu already exists, destroy it before creating a new one,
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
1507 * thus freeing-up the memory it occupied.
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
1508 */
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
1509 if(menu)
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
1510 gtk_widget_destroy(menu);
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
1511
1929
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
1512 menu = gtk_menu_new();
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
1513
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
1514 while (awy) {
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
1515 struct away_message *a = awy->data;
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
1516
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
1517 menuitem = gtk_menu_item_new_with_label(a->name);
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
1518 gtk_menu_append(GTK_MENU(menu), menuitem);
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
1519 g_signal_connect(GTK_OBJECT(menuitem), "activate",
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
1520 G_CALLBACK(do_away_message), a);
1929
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
1521 gtk_widget_show(menuitem);
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
1522 awy = awy->next;
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
1523 }
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
1524
3271
66445abf1736 [gaim-migrate @ 3289]
Jim Seymour <jseymour>
parents: 3251
diff changeset
1525 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 1, GDK_CURRENT_TIME );
1929
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
1526 }
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
1527
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1528 void rem_bp(GtkWidget *w, struct buddy_pounce *b)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1529 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1530 buddy_pounces = g_list_remove(buddy_pounces, b);
689
4e3f5d9cacd5 [gaim-migrate @ 699]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
1531 do_bp_menu();
4e3f5d9cacd5 [gaim-migrate @ 699]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
1532 save_prefs();
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1533 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1534
2131
acc11216ec5d [gaim-migrate @ 2141]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2125
diff changeset
1535 void do_pounce(struct gaim_connection *gc, char *name, int when)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1536 {
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1537 char *who;
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1538
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1539 struct buddy_pounce *b;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1540 struct conversation *c;
1155
f4d4a14752ee [gaim-migrate @ 1165]
Rob Flynn <gaim@robflynn.com>
parents: 1150
diff changeset
1541 struct aim_user *u;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1542
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1543 GList *bp = buddy_pounces;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1544
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1545 who = g_strdup(normalize (name));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1546
1857
9ea0b9531bc9 [gaim-migrate @ 1867]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1825
diff changeset
1547 while (bp) {
1155
f4d4a14752ee [gaim-migrate @ 1165]
Rob Flynn <gaim@robflynn.com>
parents: 1150
diff changeset
1548 b = (struct buddy_pounce *)bp->data;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1549 bp = bp->next; /* increment the list here because rem_bp can make our handle bad */
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1550
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1551 if (!(b->options & when))
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1552 continue;
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1553
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1554 u = find_user(b->pouncer, b->protocol); /* find our user */
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1555 if (u == NULL)
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1556 continue;
1155
f4d4a14752ee [gaim-migrate @ 1165]
Rob Flynn <gaim@robflynn.com>
parents: 1150
diff changeset
1557
1230
5395053cdee1 [gaim-migrate @ 1240]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1229
diff changeset
1558 /* check and see if we're signed on as the pouncer */
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1559 if (u->gc != gc)
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1560 continue;
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1561
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1562 if (!g_strcasecmp(who, normalize (b->name))) { /* find someone to pounce */
1857
9ea0b9531bc9 [gaim-migrate @ 1867]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1825
diff changeset
1563 if (b->options & OPT_POUNCE_POPUP) {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1564 c = find_conversation(name);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1565 if (c == NULL)
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1566 c = new_conversation(name);
1857
9ea0b9531bc9 [gaim-migrate @ 1867]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1825
diff changeset
1567
1898
73d73939f698 [gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1881
diff changeset
1568 set_convo_gc(c, u->gc);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1569 }
2550
01dad6d8ba5b [gaim-migrate @ 2563]
Rob Flynn <gaim@robflynn.com>
parents: 2472
diff changeset
1570 if (b->options & OPT_POUNCE_NOTIFY) {
01dad6d8ba5b [gaim-migrate @ 2563]
Rob Flynn <gaim@robflynn.com>
parents: 2472
diff changeset
1571 char tmp[1024];
01dad6d8ba5b [gaim-migrate @ 2563]
Rob Flynn <gaim@robflynn.com>
parents: 2472
diff changeset
1572
01dad6d8ba5b [gaim-migrate @ 2563]
Rob Flynn <gaim@robflynn.com>
parents: 2472
diff changeset
1573 /* I know the line below is really ugly. I only did it this way
01dad6d8ba5b [gaim-migrate @ 2563]
Rob Flynn <gaim@robflynn.com>
parents: 2472
diff changeset
1574 * because I thought it'd be funny :-) */
01dad6d8ba5b [gaim-migrate @ 2563]
Rob Flynn <gaim@robflynn.com>
parents: 2472
diff changeset
1575
4276
32fcf4cf5f80 [gaim-migrate @ 4527]
Luke Schierer <lschiere@pidgin.im>
parents: 4239
diff changeset
1576 g_snprintf(tmp, sizeof(tmp),
32fcf4cf5f80 [gaim-migrate @ 4527]
Luke Schierer <lschiere@pidgin.im>
parents: 4239
diff changeset
1577 (when & OPT_POUNCE_TYPING) ? _("%s has started typing to you") :
32fcf4cf5f80 [gaim-migrate @ 4527]
Luke Schierer <lschiere@pidgin.im>
parents: 4239
diff changeset
1578 (when & OPT_POUNCE_SIGNON) ? _("%s has signed on") :
32fcf4cf5f80 [gaim-migrate @ 4527]
Luke Schierer <lschiere@pidgin.im>
parents: 4239
diff changeset
1579 (when & OPT_POUNCE_UNIDLE) ? _("%s has returned from being idle") :
32fcf4cf5f80 [gaim-migrate @ 4527]
Luke Schierer <lschiere@pidgin.im>
parents: 4239
diff changeset
1580 _("%s has returned from being away"), name);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2986
diff changeset
1581
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3416
diff changeset
1582 do_error_dialog(tmp, NULL, GAIM_INFO);
2550
01dad6d8ba5b [gaim-migrate @ 2563]
Rob Flynn <gaim@robflynn.com>
parents: 2472
diff changeset
1583 }
1857
9ea0b9531bc9 [gaim-migrate @ 1867]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1825
diff changeset
1584 if (b->options & OPT_POUNCE_SEND_IM) {
2550
01dad6d8ba5b [gaim-migrate @ 2563]
Rob Flynn <gaim@robflynn.com>
parents: 2472
diff changeset
1585 if (strlen(b->message) > 0) {
2552
83f914362d72 [gaim-migrate @ 2565]
Rob Flynn <gaim@robflynn.com>
parents: 2550
diff changeset
1586 c = find_conversation(name);
83f914362d72 [gaim-migrate @ 2565]
Rob Flynn <gaim@robflynn.com>
parents: 2550
diff changeset
1587
83f914362d72 [gaim-migrate @ 2565]
Rob Flynn <gaim@robflynn.com>
parents: 2550
diff changeset
1588 if (c == NULL)
83f914362d72 [gaim-migrate @ 2565]
Rob Flynn <gaim@robflynn.com>
parents: 2550
diff changeset
1589 c = new_conversation(name);
83f914362d72 [gaim-migrate @ 2565]
Rob Flynn <gaim@robflynn.com>
parents: 2550
diff changeset
1590
83f914362d72 [gaim-migrate @ 2565]
Rob Flynn <gaim@robflynn.com>
parents: 2550
diff changeset
1591 set_convo_gc(c, u->gc);
83f914362d72 [gaim-migrate @ 2565]
Rob Flynn <gaim@robflynn.com>
parents: 2550
diff changeset
1592
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2824
diff changeset
1593 write_to_conv(c, b->message, WFLAG_SEND, NULL, time(NULL), -1);
3033
1143524a2eaf [gaim-migrate @ 3046]
Sean Egan <seanegan@gmail.com>
parents: 3032
diff changeset
1594 serv_send_im(u->gc, name, b->message, -1, 0);
2550
01dad6d8ba5b [gaim-migrate @ 2563]
Rob Flynn <gaim@robflynn.com>
parents: 2472
diff changeset
1595 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1596 }
1857
9ea0b9531bc9 [gaim-migrate @ 1867]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1825
diff changeset
1597 if (b->options & OPT_POUNCE_COMMAND) {
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
1598 #ifndef _WIN32
1229
229bf438c591 [gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1183
diff changeset
1599 int pid = fork();
229bf438c591 [gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1183
diff changeset
1600
229bf438c591 [gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1183
diff changeset
1601 if (pid == 0) {
229bf438c591 [gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1183
diff changeset
1602 char *args[4];
229bf438c591 [gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1183
diff changeset
1603 args[0] = "sh";
229bf438c591 [gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1183
diff changeset
1604 args[1] = "-c";
229bf438c591 [gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1183
diff changeset
1605 args[2] = b->command;
229bf438c591 [gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1183
diff changeset
1606 args[3] = NULL;
229bf438c591 [gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1183
diff changeset
1607 execvp(args[0], args);
229bf438c591 [gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1183
diff changeset
1608 _exit(0);
229bf438c591 [gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1183
diff changeset
1609 }
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
1610 #endif /*_WIN32*/
1229
229bf438c591 [gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1183
diff changeset
1611 }
1857
9ea0b9531bc9 [gaim-migrate @ 1867]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1825
diff changeset
1612 if (b->options & OPT_POUNCE_SOUND) {
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1613 if (strlen(b->sound))
1857
9ea0b9531bc9 [gaim-migrate @ 1867]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1825
diff changeset
1614 play_file(b->sound);
1694
bea407767ac1 [gaim-migrate @ 1704]
Rob Flynn <gaim@robflynn.com>
parents: 1693
diff changeset
1615 else
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 3059
diff changeset
1616 play_sound(SND_POUNCE_DEFAULT);
1694
bea407767ac1 [gaim-migrate @ 1704]
Rob Flynn <gaim@robflynn.com>
parents: 1693
diff changeset
1617 }
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1618
1235
a9cf2f61a7b1 [gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1233
diff changeset
1619 if (!(b->options & OPT_POUNCE_SAVE))
a9cf2f61a7b1 [gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1233
diff changeset
1620 rem_bp(NULL, b);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1621
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1622 }
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1623 }
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1624 g_free(who);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1625 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1626
2569
a714b8223228 [gaim-migrate @ 2582]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2564
diff changeset
1627 static void new_bp_callback(GtkWidget *w, struct buddy *b)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1628 {
2569
a714b8223228 [gaim-migrate @ 2582]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2564
diff changeset
1629 if (b)
2986
1c6a3516e1ff [gaim-migrate @ 2999]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
1630 show_new_bp(b->name, b->gc, b->idle, b->uc & UC_UNAVAILABLE, NULL);
2569
a714b8223228 [gaim-migrate @ 2582]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2564
diff changeset
1631 else
2986
1c6a3516e1ff [gaim-migrate @ 2999]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
1632 show_new_bp(NULL, NULL, 0, 0, NULL);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1633 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1634
2986
1c6a3516e1ff [gaim-migrate @ 2999]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
1635 static void edit_bp_callback(GtkWidget *w, struct buddy_pounce *b)
1c6a3516e1ff [gaim-migrate @ 2999]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
1636 {
1c6a3516e1ff [gaim-migrate @ 2999]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
1637 show_new_bp(NULL, NULL, 0, 0, b);
1c6a3516e1ff [gaim-migrate @ 2999]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
1638 }
1c6a3516e1ff [gaim-migrate @ 2999]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
1639
1c6a3516e1ff [gaim-migrate @ 2999]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
1640 static GtkTooltips *bp_tooltip = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1641 void do_bp_menu()
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1642 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1643 GtkWidget *menuitem, *mess, *messmenu;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1644 static GtkWidget *remmenu;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1645 GtkWidget *remitem;
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1646 GtkWidget *sep;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1647 GList *l;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1648 struct buddy_pounce *b;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1649 GList *bp = buddy_pounces;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1650
2986
1c6a3516e1ff [gaim-migrate @ 2999]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
1651 /* Tooltip for editing bp's */
1c6a3516e1ff [gaim-migrate @ 2999]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
1652 if(!bp_tooltip)
1c6a3516e1ff [gaim-migrate @ 2999]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
1653 bp_tooltip = gtk_tooltips_new();
1c6a3516e1ff [gaim-migrate @ 2999]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
1654
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1655 l = gtk_container_children(GTK_CONTAINER(bpmenu));
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1656
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1657 while (l) {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1658 gtk_widget_destroy(GTK_WIDGET(l->data));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1659 l = l->next;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1660 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1661
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1662 remmenu = gtk_menu_new();
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1663
350
fd3cc0a28d5d [gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
1664 menuitem = gtk_menu_item_new_with_label(_("New Buddy Pounce"));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1665 gtk_menu_append(GTK_MENU(bpmenu), menuitem);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1666 gtk_widget_show(menuitem);
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
1667 g_signal_connect(GTK_OBJECT(menuitem), "activate", G_CALLBACK(new_bp_callback), NULL);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1668
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1669
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1670 while (bp) {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1671
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1672 b = (struct buddy_pounce *)bp->data;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1673 remitem = gtk_menu_item_new_with_label(b->name);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1674 gtk_menu_append(GTK_MENU(remmenu), remitem);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1675 gtk_widget_show(remitem);
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
1676 g_signal_connect(GTK_OBJECT(remitem), "activate", G_CALLBACK(rem_bp), b);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1677
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1678 bp = bp->next;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1679
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1680 }
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1681
350
fd3cc0a28d5d [gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
1682 menuitem = gtk_menu_item_new_with_label(_("Remove Buddy Pounce"));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1683 gtk_menu_append(GTK_MENU(bpmenu), menuitem);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1684 gtk_widget_show(menuitem);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1685 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), remmenu);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1686 gtk_widget_show(remmenu);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1687
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1688 sep = gtk_hseparator_new();
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1689 menuitem = gtk_menu_item_new();
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1690 gtk_menu_append(GTK_MENU(bpmenu), menuitem);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1691 gtk_container_add(GTK_CONTAINER(menuitem), sep);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1692 gtk_widget_set_sensitive(menuitem, FALSE);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1693 gtk_widget_show(menuitem);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1694 gtk_widget_show(sep);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1695
1138
68f2f021ad1b [gaim-migrate @ 1148]
Rob Flynn <gaim@robflynn.com>
parents: 1137
diff changeset
1696 bp = buddy_pounces;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1697
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1698 while (bp) {
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1699
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1700 b = (struct buddy_pounce *)bp->data;
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1701
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1702 menuitem = gtk_menu_item_new_with_label(b->name);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1703 gtk_menu_append(GTK_MENU(bpmenu), menuitem);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1704 messmenu = gtk_menu_new();
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1705 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), messmenu);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1706 gtk_widget_show(menuitem);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1707
4154
3468d666d3cc [gaim-migrate @ 4382]
Mark Doliner <mark@kingant.net>
parents: 4144
diff changeset
1708 if (strlen(b->message))
3468d666d3cc [gaim-migrate @ 4382]
Mark Doliner <mark@kingant.net>
parents: 4144
diff changeset
1709 mess = gtk_menu_item_new_with_label(b->message);
3468d666d3cc [gaim-migrate @ 4382]
Mark Doliner <mark@kingant.net>
parents: 4144
diff changeset
1710 else
4155
2a57ee4b4868 [gaim-migrate @ 4383]
Mark Doliner <mark@kingant.net>
parents: 4154
diff changeset
1711 mess = gtk_menu_item_new_with_label(_("[no message]"));
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1712 gtk_menu_append(GTK_MENU(messmenu), mess);
2986
1c6a3516e1ff [gaim-migrate @ 2999]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
1713 gtk_tooltips_set_tip(bp_tooltip, GTK_WIDGET(mess), _("[Click to edit]"), NULL);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1714 gtk_widget_show(mess);
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
1715 g_signal_connect(GTK_OBJECT(mess), "activate", G_CALLBACK(edit_bp_callback), b);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1716 bp = bp->next;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1717
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1718 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1719
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1720 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1721
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1722
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1723 static struct group_show *find_group_show(char *group)
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1724 {
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1725 GSList *m = shows;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1726 struct group_show *g = NULL;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1727 char *who = g_strdup(normalize (group));
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1728
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1729 while (m) {
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1730 g = (struct group_show *)m->data;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1731 if (!g_strcasecmp(normalize (g->name), who))
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1732 break;
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1733 g = NULL;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1734 m = m->next;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1735 }
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
1736 g_free(who);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1737
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1738 return g;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1739 }
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1740
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1741 static struct buddy_show *find_buddy_show(struct group_show *gs, char *name)
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1742 {
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1743 GSList *m = gs->members;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1744 struct buddy_show *b = NULL;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1745 char *who = g_strdup(normalize (name));
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1746
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1747 while (m) {
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1748 b = (struct buddy_show *)m->data;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1749 if (!g_strcasecmp(normalize (b->name), who))
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1750 break;
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1751 b = NULL;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1752 m = m->next;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1753 }
1098
b335c0ce305e [gaim-migrate @ 1108]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1097
diff changeset
1754 g_free(who);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1755
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1756 return b;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1757 }
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1758
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1759 static int group_number(char *group)
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1760 {
1037
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1761 GSList *c = connections;
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1762 struct gaim_connection *g;
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1763 GSList *m;
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1764 struct group *p;
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1765 int pos = 0;
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1766
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1767 while (c) {
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1768 g = (struct gaim_connection *)c->data;
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1769 m = g->groups;
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1770 while (m) {
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1771 p = (struct group *)m->data;
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1772 if (!strcmp(p->name, group))
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1773 return pos;
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1774 if (find_group_show(p->name))
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1775 pos++;
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1776 m = m->next;
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1777 }
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1778 c = c->next;
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1779 }
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1780 /* um..... we'll never get here */
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1781 return -1;
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1782 }
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1783
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1784 static int buddy_number(char *group, char *buddy)
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1785 {
1037
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1786 GSList *c = connections;
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1787 struct gaim_connection *g;
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1788 struct group *p;
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1789 GSList *z;
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1790 struct buddy *b;
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1791 int pos = 0;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1792 char *tmp1 = g_strdup(normalize (buddy));
1037
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1793 struct group_show *gs = find_group_show(group);
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1794
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1795 while (c) {
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1796 g = (struct gaim_connection *)c->data;
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1797 p = find_group(g, group);
1049
749e25dc90cb [gaim-migrate @ 1059]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1047
diff changeset
1798 if (!p) {
749e25dc90cb [gaim-migrate @ 1059]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1047
diff changeset
1799 c = c->next;
749e25dc90cb [gaim-migrate @ 1059]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1047
diff changeset
1800 continue;
749e25dc90cb [gaim-migrate @ 1059]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1047
diff changeset
1801 }
1037
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1802 z = p->members;
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1803 while (z) {
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1804 b = (struct buddy *)z->data;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1805 if (!strcmp(tmp1, normalize (b->name))) {
1037
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1806 g_free(tmp1);
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1807 return pos;
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1808 }
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1809 if (find_buddy_show(gs, b->name))
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1810 pos++;
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1811 z = z->next;
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1812 }
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1813 c = c->next;
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1814 }
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1815 /* we shouldn't ever get here */
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1816 debug_printf("got to bad place in buddy_number\n");
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1817 g_free(tmp1);
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1818 return -1;
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1819 }
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1820
3131
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1821
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1822
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1823 static struct group_show *new_group_show(char *group)
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1824 {
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1825 struct group_show *g = g_new0(struct group_show, 1);
1037
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1826 int pos = group_number(group);
3131
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1827 GdkPixmap *pm;
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1828 GdkBitmap *bm;
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1829 GtkStyle *style;
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1830 GtkStyle *style2;
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1831
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1832 g->name = g_strdup(group);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1833
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1834 g->item = gtk_tree_item_new();
3131
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1835
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
1836 g_signal_connect(GTK_OBJECT(g->item), "button_press_event",
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
1837 G_CALLBACK(handle_click_group), g);
3131
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1838
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1839 gtk_tree_insert(GTK_TREE(buddies), g->item, pos);
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1840
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1841 gtk_widget_show(g->item);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1842
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1843 g->label = gtk_label_new(group);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1844 gtk_misc_set_alignment(GTK_MISC(g->label), 0.0, 0.5);
3131
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1845 gtk_widget_show(g->label);
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1846
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1847 gtk_container_add(GTK_CONTAINER(g->item), g->label);
3131
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1848
1037
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1849 shows = g_slist_insert(shows, g, pos);
3131
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1850
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1851 /* Rob does drugs - this is still evil, damn you becausse I SAID SO! */
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1852
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1853 pm = gdk_pixmap_create_from_xpm_d(g->item->window,
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1854 &bm, NULL, arrow_down_xpm);
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1855
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1856 gtk_pixmap_set(GTK_PIXMAP(GTK_TREE_ITEM(g->item)->minus_pix_widget),
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1857 pm, bm);
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1858
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1859 gdk_pixmap_unref(pm);
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1860 gdk_bitmap_unref(bm);
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1861
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1862 pm = gdk_pixmap_create_from_xpm_d(buddies->window,
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1863 &bm, NULL, arrow_right_xpm);
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1864
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1865 gtk_pixmap_set(GTK_PIXMAP(GTK_TREE_ITEM(g->item)->plus_pix_widget),
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1866 pm, bm);
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1867
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1868 gdk_pixmap_unref(pm);
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1869 gdk_bitmap_unref(bm);
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1870
3133
a2c6727e3c1b [gaim-migrate @ 3148]
Rob Flynn <gaim@robflynn.com>
parents: 3131
diff changeset
1871 // style = gtk_widget_get_style(GTK_TREE_ITEM(g->item)->pixmaps_box);
a2c6727e3c1b [gaim-migrate @ 3148]
Rob Flynn <gaim@robflynn.com>
parents: 3131
diff changeset
1872 style2 = gtk_style_copy(gtk_widget_get_style(g->item));
a2c6727e3c1b [gaim-migrate @ 3148]
Rob Flynn <gaim@robflynn.com>
parents: 3131
diff changeset
1873 style = gtk_style_copy(gtk_widget_get_style(GTK_WIDGET(g->label)));
3137
b7fce1bf6b87 [gaim-migrate @ 3152]
Rob Flynn <gaim@robflynn.com>
parents: 3136
diff changeset
1874
3131
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1875 style->bg[0] = style2->base[0];
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1876 gtk_widget_set_style(GTK_TREE_ITEM(g->item)->pixmaps_box, style);
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1877
3137
b7fce1bf6b87 [gaim-migrate @ 3152]
Rob Flynn <gaim@robflynn.com>
parents: 3136
diff changeset
1878 gtk_style_unref(style);
b7fce1bf6b87 [gaim-migrate @ 3152]
Rob Flynn <gaim@robflynn.com>
parents: 3136
diff changeset
1879 gtk_style_unref(style2);
b7fce1bf6b87 [gaim-migrate @ 3152]
Rob Flynn <gaim@robflynn.com>
parents: 3136
diff changeset
1880
3131
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1881 /* bad drugs */
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1882
2883
c12e3e66d54a [gaim-migrate @ 2896]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2856
diff changeset
1883 update_num_group(g);
3131
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1884
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1885 return g;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1886 }
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1887
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1888 static struct buddy_show *new_buddy_show(struct group_show *gs, struct buddy *buddy, char **xpm)
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1889 {
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1890 struct buddy_show *b = g_new0(struct buddy_show, 1);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1891 GtkWidget *box;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1892 GdkPixmap *pm;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1893 GdkBitmap *bm;
1037
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1894 int pos = buddy_number(gs->name, buddy->name);
1299
18c3874ea051 [gaim-migrate @ 1309]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1297
diff changeset
1895 b->sound = 0;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1896
1409
17e544f8c7fb [gaim-migrate @ 1419]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1401
diff changeset
1897 if (gs->members == NULL) {
17e544f8c7fb [gaim-migrate @ 1419]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1401
diff changeset
1898 gs->tree = gtk_tree_new();
17e544f8c7fb [gaim-migrate @ 1419]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1401
diff changeset
1899 gtk_tree_item_set_subtree(GTK_TREE_ITEM(gs->item), gs->tree);
17e544f8c7fb [gaim-migrate @ 1419]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1401
diff changeset
1900 gtk_tree_item_expand(GTK_TREE_ITEM(gs->item));
17e544f8c7fb [gaim-migrate @ 1419]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1401
diff changeset
1901 gtk_widget_show(gs->tree);
17e544f8c7fb [gaim-migrate @ 1419]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1401
diff changeset
1902 }
17e544f8c7fb [gaim-migrate @ 1419]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1401
diff changeset
1903
1036
faa5afc2b89e [gaim-migrate @ 1046]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1033
diff changeset
1904 b->name = g_strdup(buddy->name);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1905
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1906 b->item = gtk_tree_item_new();
1037
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1907 gtk_tree_insert(GTK_TREE(gs->tree), b->item, pos);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1908 gtk_object_set_user_data(GTK_OBJECT(b->item), b);
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
1909 g_signal_connect(GTK_OBJECT(b->item), "button_press_event",
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
1910 G_CALLBACK(handle_click_buddy), b);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1911 gtk_widget_show(b->item);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1912
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1913 box = gtk_hbox_new(FALSE, 1);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1914 gtk_container_add(GTK_CONTAINER(b->item), box);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1915 gtk_widget_show(box);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1916
1729
251c19bf5763 [gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1714
diff changeset
1917 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, NULL, xpm ? xpm : no_icon_xpm);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1918 b->pix = gtk_pixmap_new(pm, bm);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1919 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
1920 gtk_widget_show(b->pix);
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2281
diff changeset
1921 if (!(blist_options & OPT_BLIST_SHOW_PIXMAPS))
1711
9b86520e04ac [gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1699
diff changeset
1922 gtk_widget_hide(b->pix);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1923 gdk_pixmap_unref(pm);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1924 gdk_bitmap_unref(bm);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1925
4227
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
1926 b->label = gtk_label_new(get_buddy_alias(buddy));
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1927 gtk_misc_set_alignment(GTK_MISC(b->label), 0.0, 0.5);
1242
8cb5c1000ea9 [gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1928 gtk_box_pack_start(GTK_BOX(box), b->label, FALSE, FALSE, 1);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1929 gtk_widget_show(b->label);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1930
1242
8cb5c1000ea9 [gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1931 b->warn = gtk_label_new("");
8cb5c1000ea9 [gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1932 gtk_box_pack_start(GTK_BOX(box), b->warn, FALSE, FALSE, 1);
8cb5c1000ea9 [gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1933 gtk_widget_show(b->warn);
8cb5c1000ea9 [gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1934
1058
4927ce25d8cc [gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
1935 b->idle = gtk_label_new("");
1242
8cb5c1000ea9 [gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1936 gtk_box_pack_end(GTK_BOX(box), b->idle, FALSE, FALSE, 1);
1058
4927ce25d8cc [gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
1937 gtk_widget_show(b->idle);
4927ce25d8cc [gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
1938
1037
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1939 gs->members = g_slist_insert(gs->members, b, pos);
1070
b288f17c2fb2 [gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1069
diff changeset
1940 update_num_group(gs);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1941 return b;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1942 }
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1943
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1944 static void remove_buddy_show(struct group_show *gs, struct buddy_show *bs)
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1945 {
1108
cb338aa38e78 [gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
1946 /* the name of this function may be misleading, but don't let it fool you. the point
cb338aa38e78 [gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
1947 * of this is to remove bs->item from gs->tree, and make sure gs->tree still exists
cb338aa38e78 [gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
1948 * and is a valid tree afterwards. Otherwise, Bad Things will happen. */
cb338aa38e78 [gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
1949 gtk_tree_remove_item(GTK_TREE(gs->tree), bs->item);
cb338aa38e78 [gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
1950 bs->item = NULL;
cb338aa38e78 [gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
1951 }
cb338aa38e78 [gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
1952
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1953 static struct group_show *find_gs_by_bs(struct buddy_show *b)
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1954 {
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1955 GSList *m, *n;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1956 struct group_show *g = NULL;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1957 struct buddy_show *h;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1958
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1959 m = shows;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1960 while (m) {
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1961 g = (struct group_show *)m->data;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1962 n = g->members;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1963 while (n) {
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1964 h = (struct buddy_show *)n->data;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1965 if (h == b)
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1966 return g;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1967 n = n->next;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1968 }
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1969 g = NULL;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1970 m = m->next;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1971 }
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1972
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1973 return g;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1974 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1975
3472
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
1976 /* used by this file, and by iconaway.so */
3188
49fb2b634a2a [gaim-migrate @ 3205]
Sean Egan <seanegan@gmail.com>
parents: 3159
diff changeset
1977 void hide_buddy_list() {
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents: 3508
diff changeset
1978 if (blist) {
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3510
diff changeset
1979 if (!connections || docklet_count) {
3970
3bc436a24548 [gaim-migrate @ 4154]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3948
diff changeset
1980 #ifdef _WIN32
3bc436a24548 [gaim-migrate @ 4154]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3948
diff changeset
1981 /* minimize to systray with effects */
3bc436a24548 [gaim-migrate @ 4154]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3948
diff changeset
1982 wgaim_systray_minimize(blist);
3bc436a24548 [gaim-migrate @ 4154]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3948
diff changeset
1983 #endif
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents: 3508
diff changeset
1984 gtk_widget_hide(blist);
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents: 3508
diff changeset
1985 } else {
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents: 3508
diff changeset
1986 gtk_window_iconify(GTK_WINDOW(blist));
3472
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
1987 }
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
1988 }
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
1989 }
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
1990
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
1991 /* mostly used by code in this file */
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
1992 void unhide_buddy_list() {
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents: 3508
diff changeset
1993 if (blist) {
4108
274cb26ba8dc [gaim-migrate @ 4323]
Luke Schierer <lschiere@pidgin.im>
parents: 4082
diff changeset
1994 if (!GTK_WIDGET_VISIBLE(blist) && blist_options & OPT_BLIST_SAVED_WINDOWS &&
274cb26ba8dc [gaim-migrate @ 4323]
Luke Schierer <lschiere@pidgin.im>
parents: 4082
diff changeset
1995 blist_pos.width != 0) {
3939
49d42b275a68 [gaim-migrate @ 4115]
Luke Schierer <lschiere@pidgin.im>
parents: 3902
diff changeset
1996 /* don't move it off screen */
49d42b275a68 [gaim-migrate @ 4115]
Luke Schierer <lschiere@pidgin.im>
parents: 3902
diff changeset
1997 if (blist_pos.x >= gdk_screen_width()) {
49d42b275a68 [gaim-migrate @ 4115]
Luke Schierer <lschiere@pidgin.im>
parents: 3902
diff changeset
1998 blist_pos.x = gdk_screen_width() - 100;
49d42b275a68 [gaim-migrate @ 4115]
Luke Schierer <lschiere@pidgin.im>
parents: 3902
diff changeset
1999 } else if (blist_pos.x <= 0) {
49d42b275a68 [gaim-migrate @ 4115]
Luke Schierer <lschiere@pidgin.im>
parents: 3902
diff changeset
2000 blist_pos.x = 100;
49d42b275a68 [gaim-migrate @ 4115]
Luke Schierer <lschiere@pidgin.im>
parents: 3902
diff changeset
2001 }
49d42b275a68 [gaim-migrate @ 4115]
Luke Schierer <lschiere@pidgin.im>
parents: 3902
diff changeset
2002
49d42b275a68 [gaim-migrate @ 4115]
Luke Schierer <lschiere@pidgin.im>
parents: 3902
diff changeset
2003 if (blist_pos.y >= gdk_screen_height()) {
49d42b275a68 [gaim-migrate @ 4115]
Luke Schierer <lschiere@pidgin.im>
parents: 3902
diff changeset
2004 blist_pos.y = gdk_screen_height() - 100;
49d42b275a68 [gaim-migrate @ 4115]
Luke Schierer <lschiere@pidgin.im>
parents: 3902
diff changeset
2005 } else if (blist_pos.y <= 0) {
49d42b275a68 [gaim-migrate @ 4115]
Luke Schierer <lschiere@pidgin.im>
parents: 3902
diff changeset
2006 blist_pos.y = 100;
49d42b275a68 [gaim-migrate @ 4115]
Luke Schierer <lschiere@pidgin.im>
parents: 3902
diff changeset
2007 }
49d42b275a68 [gaim-migrate @ 4115]
Luke Schierer <lschiere@pidgin.im>
parents: 3902
diff changeset
2008
3540
785292d72aed [gaim-migrate @ 3615]
Luke Schierer <lschiere@pidgin.im>
parents: 3539
diff changeset
2009 gtk_window_move(GTK_WINDOW(blist), blist_pos.x, blist_pos.y);
785292d72aed [gaim-migrate @ 3615]
Luke Schierer <lschiere@pidgin.im>
parents: 3539
diff changeset
2010 gtk_window_resize(GTK_WINDOW(blist), blist_pos.width, blist_pos.height);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents: 3508
diff changeset
2011 }
3939
49d42b275a68 [gaim-migrate @ 4115]
Luke Schierer <lschiere@pidgin.im>
parents: 3902
diff changeset
2012
49d42b275a68 [gaim-migrate @ 4115]
Luke Schierer <lschiere@pidgin.im>
parents: 3902
diff changeset
2013 gtk_window_present(GTK_WINDOW(blist));
3472
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
2014 }
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
2015 }
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
2016
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
2017 /* for the delete_event handler */
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
2018 static void close_buddy_list() {
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3510
diff changeset
2019 if (docklet_count) {
3472
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
2020 hide_buddy_list();
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
2021 } else {
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
2022 do_quit();
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
2023 }
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
2024 }
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
2025
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
2026 void docklet_add() {
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3510
diff changeset
2027 docklet_count++;
3519
c078fba4d7e3 [gaim-migrate @ 3592]
Luke Schierer <lschiere@pidgin.im>
parents: 3517
diff changeset
2028 debug_printf("docklet_count: %d\n",docklet_count);
3472
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
2029 }
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
2030
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
2031 void docklet_remove() {
3726
d85208a99af2 [gaim-migrate @ 3862]
Luke Schierer <lschiere@pidgin.im>
parents: 3716
diff changeset
2032 docklet_count--;
3519
c078fba4d7e3 [gaim-migrate @ 3592]
Luke Schierer <lschiere@pidgin.im>
parents: 3517
diff changeset
2033 debug_printf("docklet_count: %d\n",docklet_count);
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3510
diff changeset
2034 if (!docklet_count) {
3472
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
2035 if (connections) {
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
2036 unhide_buddy_list();
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
2037 } else {
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
2038 gtk_window_present(GTK_WINDOW(mainwindow));
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
2039 }
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
2040 }
3192
3d2d57dba56b [gaim-migrate @ 3209]
Sean Egan <seanegan@gmail.com>
parents: 3189
diff changeset
2041 }
3d2d57dba56b [gaim-migrate @ 3209]
Sean Egan <seanegan@gmail.com>
parents: 3189
diff changeset
2042
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2043 void docklet_toggle() {
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2044 /* Useful for the docklet plugin and also for the win32 tray icon*/
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2045 /* This is called when one of those is clicked--it will show/hide the
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2046 buddy list/login window--depending on which is active */
3726
d85208a99af2 [gaim-migrate @ 3862]
Luke Schierer <lschiere@pidgin.im>
parents: 3716
diff changeset
2047 if (connections && blist) {
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2048 if (GTK_WIDGET_VISIBLE(blist)) {
3939
49d42b275a68 [gaim-migrate @ 4115]
Luke Schierer <lschiere@pidgin.im>
parents: 3902
diff changeset
2049 if (GAIM_WINDOW_ICONIFIED(blist) || obscured) {
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2050 unhide_buddy_list();
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2051 } else {
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2052 hide_buddy_list();
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2053 }
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2054 } else {
3970
3bc436a24548 [gaim-migrate @ 4154]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3948
diff changeset
2055 #if _WIN32
3bc436a24548 [gaim-migrate @ 4154]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3948
diff changeset
2056 wgaim_systray_maximize(blist);
3bc436a24548 [gaim-migrate @ 4154]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3948
diff changeset
2057 #endif
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2058 unhide_buddy_list();
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2059 }
3726
d85208a99af2 [gaim-migrate @ 3862]
Luke Schierer <lschiere@pidgin.im>
parents: 3716
diff changeset
2060 } else if (connections) {
d85208a99af2 [gaim-migrate @ 3862]
Luke Schierer <lschiere@pidgin.im>
parents: 3716
diff changeset
2061 /* we're logging in or something... do nothing */
d85208a99af2 [gaim-migrate @ 3862]
Luke Schierer <lschiere@pidgin.im>
parents: 3716
diff changeset
2062 debug_printf("docklet_toggle called with connections but no blist!\n");
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2063 } else {
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2064 if (GTK_WIDGET_VISIBLE(mainwindow)) {
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2065 if (GAIM_WINDOW_ICONIFIED(mainwindow)) {
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2066 gtk_window_present(GTK_WINDOW(mainwindow));
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2067 } else {
3970
3bc436a24548 [gaim-migrate @ 4154]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3948
diff changeset
2068 #if _WIN32
3bc436a24548 [gaim-migrate @ 4154]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3948
diff changeset
2069 wgaim_systray_minimize(mainwindow);
3bc436a24548 [gaim-migrate @ 4154]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3948
diff changeset
2070 #endif
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2071 gtk_widget_hide(mainwindow);
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2072 }
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2073 } else {
3970
3bc436a24548 [gaim-migrate @ 4154]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3948
diff changeset
2074 #if _WIN32
3bc436a24548 [gaim-migrate @ 4154]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3948
diff changeset
2075 wgaim_systray_maximize(mainwindow);
3bc436a24548 [gaim-migrate @ 4154]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3948
diff changeset
2076 #endif
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2077 gtk_window_present(GTK_WINDOW(mainwindow));
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2078 }
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2079 }
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2080 }
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2081
4168
ebfb80bbe1ed [gaim-migrate @ 4397]
Luke Schierer <lschiere@pidgin.im>
parents: 4167
diff changeset
2082 static gboolean log_timeout(gpointer data)
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2083 {
4168
ebfb80bbe1ed [gaim-migrate @ 4397]
Luke Schierer <lschiere@pidgin.im>
parents: 4167
diff changeset
2084 struct buddy_show *b = data;
2255
aaa82fd67a7b [gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2191
diff changeset
2085 /* this part is really just a bad hack because of a bug I can't find */
aaa82fd67a7b [gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2191
diff changeset
2086 GSList *s = shows;
aaa82fd67a7b [gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2191
diff changeset
2087 while (s) {
aaa82fd67a7b [gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2191
diff changeset
2088 struct group_show *gs = s->data;
aaa82fd67a7b [gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2191
diff changeset
2089 GSList *m = gs->members;
aaa82fd67a7b [gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2191
diff changeset
2090 while (m) {
aaa82fd67a7b [gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2191
diff changeset
2091 if (b == m->data)
aaa82fd67a7b [gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2191
diff changeset
2092 break;
aaa82fd67a7b [gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2191
diff changeset
2093 m = m->next;
aaa82fd67a7b [gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2191
diff changeset
2094 }
aaa82fd67a7b [gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2191
diff changeset
2095 if (m != NULL)
aaa82fd67a7b [gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2191
diff changeset
2096 break;
aaa82fd67a7b [gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2191
diff changeset
2097 s = s->next;
aaa82fd67a7b [gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2191
diff changeset
2098 }
aaa82fd67a7b [gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2191
diff changeset
2099 if (!s)
4168
ebfb80bbe1ed [gaim-migrate @ 4397]
Luke Schierer <lschiere@pidgin.im>
parents: 4167
diff changeset
2100 return FALSE;
2255
aaa82fd67a7b [gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2191
diff changeset
2101
aaa82fd67a7b [gaim-migrate @ 2265]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2191
diff changeset
2102 /* this is the real part. */
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2103 if (!b->connlist) {
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2104 struct group_show *g = find_gs_by_bs(b);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2105 g->members = g_slist_remove(g->members, b);
1091
3d6ab4f1fa55 [gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1089
diff changeset
2106 if (blist)
1108
cb338aa38e78 [gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
2107 remove_buddy_show(g, b);
1091
3d6ab4f1fa55 [gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1089
diff changeset
2108 else
3d6ab4f1fa55 [gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1089
diff changeset
2109 debug_printf("log_timeout but buddy list not available\n");
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2281
diff changeset
2110 if ((g->members == NULL) && (blist_options & OPT_BLIST_NO_MT_GRP)) {
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2111 shows = g_slist_remove(shows, g);
1091
3d6ab4f1fa55 [gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1089
diff changeset
2112 if (blist)
1108
cb338aa38e78 [gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
2113 gtk_tree_remove_item(GTK_TREE(buddies), g->item);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2114 g_free(g->name);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2115 g_free(g);
1089
f0f5c10cce63 [gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1088
diff changeset
2116 }
4168
ebfb80bbe1ed [gaim-migrate @ 4397]
Luke Schierer <lschiere@pidgin.im>
parents: 4167
diff changeset
2117 g_source_remove(b->log_timer);
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
2118 b->log_timer = 0;
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2119 g_free(b->name);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2120 g_free(b);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2121 } else {
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2122 /* 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
2123 GdkPixmap *pm;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2124 GdkBitmap *bm;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2125 gchar **xpm = NULL;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2126 struct buddy *light = find_buddy(b->connlist->data, b->name);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2127 if (((struct gaim_connection *)b->connlist->data)->prpl->list_icon)
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2128 xpm =
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2129 (*((struct gaim_connection *)b->connlist->data)->prpl->list_icon)(light->uc);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2130 if (xpm == NULL)
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2131 xpm = (char **)no_icon_xpm;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2132 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
2133 gtk_widget_hide(b->pix);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2134 gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2135 gtk_widget_show(b->pix);
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2281
diff changeset
2136 if (!(blist_options & OPT_BLIST_SHOW_PIXMAPS))
1711
9b86520e04ac [gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1699
diff changeset
2137 gtk_widget_hide(b->pix);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2138 gdk_pixmap_unref(pm);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2139 gdk_bitmap_unref(bm);
4168
ebfb80bbe1ed [gaim-migrate @ 4397]
Luke Schierer <lschiere@pidgin.im>
parents: 4167
diff changeset
2140 g_source_remove(b->log_timer);
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
2141 b->log_timer = 0;
1299
18c3874ea051 [gaim-migrate @ 1309]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1297
diff changeset
2142 b->sound = 0;
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2143 }
4168
ebfb80bbe1ed [gaim-migrate @ 4397]
Luke Schierer <lschiere@pidgin.im>
parents: 4167
diff changeset
2144 return FALSE;
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2145 }
513
eaddaa0dbbcb [gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 511
diff changeset
2146
2920
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2906
diff changeset
2147 static char *caps_string(guint caps)
1068
ed28707debdc [gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1066
diff changeset
2148 {
ed28707debdc [gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1066
diff changeset
2149 static char buf[256], *tmp;
ed28707debdc [gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1066
diff changeset
2150 int count = 0, i = 0;
2920
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2906
diff changeset
2151 guint bit = 1;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2906
diff changeset
2152 while (bit <= 0x10000) {
1068
ed28707debdc [gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1066
diff changeset
2153 if (bit & caps) {
ed28707debdc [gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1066
diff changeset
2154 switch (bit) {
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2155 case 0x1:
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2156 tmp = _("Buddy Icon");
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2157 break;
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2158 case 0x2:
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2159 tmp = _("Voice");
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2160 break;
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2161 case 0x4:
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2162 tmp = _("IM Image");
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2163 break;
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2164 case 0x8:
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2165 tmp = _("Chat");
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2166 break;
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2167 case 0x10:
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2168 tmp = _("Get File");
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2169 break;
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2170 case 0x20:
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2171 tmp = _("Send File");
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2172 break;
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2173 case 0x40:
2669
44773c4b0f16 [gaim-migrate @ 2682]
Adam Fritzler <mid@auk.cx>
parents: 2662
diff changeset
2174 case 0x200:
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2175 tmp = _("Games");
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2176 break;
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2177 case 0x80:
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2178 tmp = _("Stocks");
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2179 break;
2920
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2906
diff changeset
2180 case 0x100:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2906
diff changeset
2181 tmp = _("Send Buddy List");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2906
diff changeset
2182 break;
2669
44773c4b0f16 [gaim-migrate @ 2682]
Adam Fritzler <mid@auk.cx>
parents: 2662
diff changeset
2183 case 0x400:
44773c4b0f16 [gaim-migrate @ 2682]
Adam Fritzler <mid@auk.cx>
parents: 2662
diff changeset
2184 tmp = _("EveryBuddy Bug");
44773c4b0f16 [gaim-migrate @ 2682]
Adam Fritzler <mid@auk.cx>
parents: 2662
diff changeset
2185 break;
2734
9fc65bb80596 [gaim-migrate @ 2747]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2731
diff changeset
2186 case 0x800:
9fc65bb80596 [gaim-migrate @ 2747]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2731
diff changeset
2187 tmp = _("AP User");
9fc65bb80596 [gaim-migrate @ 2747]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2731
diff changeset
2188 break;
2920
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2906
diff changeset
2189 case 0x1000:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2906
diff changeset
2190 tmp = _("ICQ RTF");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2906
diff changeset
2191 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2906
diff changeset
2192 case 0x2000:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2906
diff changeset
2193 tmp = _("Nihilist");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2906
diff changeset
2194 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2906
diff changeset
2195 case 0x4000:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2906
diff changeset
2196 tmp = _("ICQ Server Relay");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2906
diff changeset
2197 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2906
diff changeset
2198 case 0x8000:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2906
diff changeset
2199 tmp = _("ICQ Unknown");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2906
diff changeset
2200 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2906
diff changeset
2201 case 0x10000:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2906
diff changeset
2202 tmp = _("Trillian Encryption");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2906
diff changeset
2203 break;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2204 default:
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2205 tmp = NULL;
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2206 break;
1068
ed28707debdc [gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1066
diff changeset
2207 }
ed28707debdc [gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1066
diff changeset
2208 if (tmp)
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2209 i += g_snprintf(buf + i, sizeof(buf) - i, "%s%s", (count ? ", " : ""),
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2210 tmp);
1068
ed28707debdc [gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1066
diff changeset
2211 count++;
ed28707debdc [gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1066
diff changeset
2212 }
ed28707debdc [gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1066
diff changeset
2213 bit <<= 1;
ed28707debdc [gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1066
diff changeset
2214 }
ed28707debdc [gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1066
diff changeset
2215 return buf;
ed28707debdc [gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1066
diff changeset
2216 }
ed28707debdc [gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1066
diff changeset
2217
1163
8f70ecf3e884 [gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1159
diff changeset
2218 /* for this we're just going to assume the first connection that registered the buddy.
8f70ecf3e884 [gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1159
diff changeset
2219 * if it's not the one you were hoping for then you're shit out of luck */
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2220 static void update_idle_time(struct buddy_show *bs)
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2221 {
1075
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1072
diff changeset
2222 /* this also updates the tooltip since that has idle time in it */
1242
8cb5c1000ea9 [gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
2223 char idlet[16], warnl[16];
1058
4927ce25d8cc [gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
2224 time_t t;
4927ce25d8cc [gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
2225 int ihrs, imin;
4927ce25d8cc [gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
2226 struct buddy *b;
2592
f194dd8250d4 [gaim-migrate @ 2605]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2587
diff changeset
2227 GtkStyle *style;
1058
4927ce25d8cc [gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
2228
1163
8f70ecf3e884 [gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1159
diff changeset
2229 char infotip[2048];
1068
ed28707debdc [gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1066
diff changeset
2230 char warn[256];
ed28707debdc [gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1066
diff changeset
2231 char caps[256];
4227
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
2232 char alias[512];
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
2233 char serv_alias[512];
1815
f15d449b3167 [gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1805
diff changeset
2234 char *sotime = NULL, *itime;
1068
ed28707debdc [gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1066
diff changeset
2235
2731
e9e624d8803e [gaim-migrate @ 2744]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2730
diff changeset
2236 int i;
e9e624d8803e [gaim-migrate @ 2744]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2730
diff changeset
2237
1058
4927ce25d8cc [gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
2238 time(&t);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2239 if (!bs->connlist)
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2240 return;
1163
8f70ecf3e884 [gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1159
diff changeset
2241 b = find_buddy(bs->connlist->data, bs->name);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2242 if (!b)
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2243 return;
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2244 ihrs = (t - b->idle) / 3600;
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2245 imin = ((t - b->idle) / 60) % 60;
1058
4927ce25d8cc [gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
2246
1163
8f70ecf3e884 [gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1159
diff changeset
2247 if (ihrs)
8f70ecf3e884 [gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1159
diff changeset
2248 g_snprintf(idlet, sizeof idlet, "(%d:%02d)", ihrs, imin);
8f70ecf3e884 [gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1159
diff changeset
2249 else
8f70ecf3e884 [gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1159
diff changeset
2250 g_snprintf(idlet, sizeof idlet, "(%d)", imin);
1058
4927ce25d8cc [gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
2251
1163
8f70ecf3e884 [gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1159
diff changeset
2252 gtk_widget_hide(bs->idle);
8f70ecf3e884 [gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1159
diff changeset
2253 if (b->idle)
8f70ecf3e884 [gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1159
diff changeset
2254 gtk_label_set(GTK_LABEL(bs->idle), idlet);
8f70ecf3e884 [gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1159
diff changeset
2255 else
8f70ecf3e884 [gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1159
diff changeset
2256 gtk_label_set(GTK_LABEL(bs->idle), "");
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2281
diff changeset
2257 if (blist_options & OPT_BLIST_SHOW_IDLETIME)
1163
8f70ecf3e884 [gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1159
diff changeset
2258 gtk_widget_show(bs->idle);
1068
ed28707debdc [gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1066
diff changeset
2259
2730
a9aabf1170f1 [gaim-migrate @ 2743]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
2260 style = gtk_style_new();
a9aabf1170f1 [gaim-migrate @ 2743]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
2261 gtk_style_set_font(style, gdk_font_ref(gtk_style_get_font(bs->label->style)));
2731
e9e624d8803e [gaim-migrate @ 2744]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2730
diff changeset
2262 for (i = 0; i < 5; i++)
2736
6e1ac8ceb3c4 [gaim-migrate @ 2749]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2263 style->fg[i] = bs->idle->style->fg[i];
2610
98928712e319 [gaim-migrate @ 2623]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2607
diff changeset
2264 if ((blist_options & OPT_BLIST_GREY_IDLERS) && (b->idle)) {
2592
f194dd8250d4 [gaim-migrate @ 2605]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2587
diff changeset
2265 style->fg[GTK_STATE_NORMAL].red =
2613
6f7e1fc3e132 [gaim-migrate @ 2626]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2610
diff changeset
2266 (style->fg[GTK_STATE_NORMAL].red / 2) + (style->base[GTK_STATE_NORMAL].red / 2);
2592
f194dd8250d4 [gaim-migrate @ 2605]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2587
diff changeset
2267 style->fg[GTK_STATE_NORMAL].green =
2613
6f7e1fc3e132 [gaim-migrate @ 2626]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2610
diff changeset
2268 (style->fg[GTK_STATE_NORMAL].green / 2) + (style->base[GTK_STATE_NORMAL].green / 2);
2592
f194dd8250d4 [gaim-migrate @ 2605]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2587
diff changeset
2269 style->fg[GTK_STATE_NORMAL].blue =
2613
6f7e1fc3e132 [gaim-migrate @ 2626]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2610
diff changeset
2270 (style->fg[GTK_STATE_NORMAL].blue / 2) + (style->base[GTK_STATE_NORMAL].blue / 2);
2592
f194dd8250d4 [gaim-migrate @ 2605]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2587
diff changeset
2271 }
f194dd8250d4 [gaim-migrate @ 2605]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2587
diff changeset
2272 gtk_widget_set_style(bs->label, style);
f194dd8250d4 [gaim-migrate @ 2605]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2587
diff changeset
2273 gtk_style_unref(style);
f194dd8250d4 [gaim-migrate @ 2605]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2587
diff changeset
2274
1163
8f70ecf3e884 [gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1159
diff changeset
2275 /* now we do the tooltip */
1496
d33bf6548543 [gaim-migrate @ 1506]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1477
diff changeset
2276 if (b->signon) {
d33bf6548543 [gaim-migrate @ 1506]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1477
diff changeset
2277 char *stime = sec_to_text(t - b->signon +
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2278 ((struct gaim_connection *)bs->connlist->data)->
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2279 correction_time);
1496
d33bf6548543 [gaim-migrate @ 1506]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1477
diff changeset
2280 sotime = g_strdup_printf(_("Logged in: %s\n"), stime);
d33bf6548543 [gaim-migrate @ 1506]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1477
diff changeset
2281 g_free(stime);
d33bf6548543 [gaim-migrate @ 1506]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1477
diff changeset
2282 }
1068
ed28707debdc [gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1066
diff changeset
2283
1163
8f70ecf3e884 [gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1159
diff changeset
2284 if (b->idle)
8f70ecf3e884 [gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1159
diff changeset
2285 itime = sec_to_text(t - b->idle);
8f70ecf3e884 [gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1159
diff changeset
2286 else {
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2287 itime = g_malloc(1);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2288 itime[0] = 0;
1163
8f70ecf3e884 [gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1159
diff changeset
2289 }
1068
ed28707debdc [gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1066
diff changeset
2290
1242
8cb5c1000ea9 [gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
2291 if (b->evil) {
1163
8f70ecf3e884 [gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1159
diff changeset
2292 g_snprintf(warn, sizeof warn, _("Warnings: %d%%\n"), b->evil);
1242
8cb5c1000ea9 [gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
2293 g_snprintf(warnl, sizeof warnl, "(%d%%)", b->evil);
8cb5c1000ea9 [gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
2294 } else {
1163
8f70ecf3e884 [gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1159
diff changeset
2295 warn[0] = '\0';
1242
8cb5c1000ea9 [gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
2296 warnl[0] = '\0';
8cb5c1000ea9 [gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
2297 }
8cb5c1000ea9 [gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
2298 gtk_widget_hide(bs->warn);
8cb5c1000ea9 [gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
2299 gtk_label_set(GTK_LABEL(bs->warn), warnl);
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2281
diff changeset
2300 if (blist_options & OPT_BLIST_SHOW_WARN)
1242
8cb5c1000ea9 [gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
2301 gtk_widget_show(bs->warn);
1068
ed28707debdc [gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1066
diff changeset
2302
1163
8f70ecf3e884 [gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1159
diff changeset
2303 if (b->caps)
8f70ecf3e884 [gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1159
diff changeset
2304 g_snprintf(caps, sizeof caps, _("Capabilities: %s\n"), caps_string(b->caps));
8f70ecf3e884 [gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1159
diff changeset
2305 else
8f70ecf3e884 [gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1159
diff changeset
2306 caps[0] = '\0';
1068
ed28707debdc [gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1066
diff changeset
2307
4227
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
2308 if (b->alias[0])
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
2309 g_snprintf(alias, sizeof alias, _("Alias: %s\n"), b->alias);
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
2310 else
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
2311 alias[0] = '\0';
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
2312
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
2313 if (b->server_alias[0])
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
2314 g_snprintf(serv_alias, sizeof serv_alias, _("Nickname: %s\n"),
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
2315 b->server_alias);
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
2316 else
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
2317 serv_alias[0] = '\0';
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
2318
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
2319 g_snprintf(infotip, sizeof infotip, _("%s%sScreen Name: %s\n%s%s%s%s%s%s"),
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
2320 alias, serv_alias, b->name, (b->signon ? sotime : ""), warn,
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2321 (b->idle ? _("Idle: ") : ""), itime, (b->idle ? "\n" : ""), caps);
1068
ed28707debdc [gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1066
diff changeset
2322
1163
8f70ecf3e884 [gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1159
diff changeset
2323 gtk_tooltips_set_tip(tips, GTK_WIDGET(bs->item), infotip, "");
1068
ed28707debdc [gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1066
diff changeset
2324
1496
d33bf6548543 [gaim-migrate @ 1506]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1477
diff changeset
2325 if (b->signon)
d33bf6548543 [gaim-migrate @ 1506]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1477
diff changeset
2326 g_free(sotime);
1163
8f70ecf3e884 [gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1159
diff changeset
2327 g_free(itime);
1058
4927ce25d8cc [gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
2328 }
4927ce25d8cc [gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
2329
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2330 void update_idle_times()
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2331 {
1058
4927ce25d8cc [gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
2332 GSList *grp = shows;
4927ce25d8cc [gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
2333 GSList *mem;
1667
b5635d882116 [gaim-migrate @ 1677]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1666
diff changeset
2334 struct buddy_show *b;
b5635d882116 [gaim-migrate @ 1677]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1666
diff changeset
2335 struct group_show *g;
1058
4927ce25d8cc [gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
2336
4927ce25d8cc [gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
2337 while (grp) {
1667
b5635d882116 [gaim-migrate @ 1677]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1666
diff changeset
2338 g = (struct group_show *)grp->data;
b5635d882116 [gaim-migrate @ 1677]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1666
diff changeset
2339 mem = g->members;
1058
4927ce25d8cc [gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
2340 while (mem) {
1667
b5635d882116 [gaim-migrate @ 1677]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1666
diff changeset
2341 b = (struct buddy_show *)mem->data;
b5635d882116 [gaim-migrate @ 1677]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1666
diff changeset
2342 update_idle_time(b);
1058
4927ce25d8cc [gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
2343 mem = mem->next;
4927ce25d8cc [gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
2344 }
4927ce25d8cc [gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
2345 grp = grp->next;
4927ce25d8cc [gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
2346 }
4927ce25d8cc [gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
2347 }
4927ce25d8cc [gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
2348
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2349 void set_buddy(struct gaim_connection *gc, struct buddy *b)
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2350 {
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2351 struct group *g = find_group_by_buddy(gc, b->name);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2352 struct group_show *gs;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2353 struct buddy_show *bs;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2354 GdkPixmap *pm;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2355 GdkBitmap *bm;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2356 char **xpm = NULL;
1058
4927ce25d8cc [gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
2357
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2358 if (!blist)
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2359 return;
1063
e1408fb04c36 [gaim-migrate @ 1073]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1061
diff changeset
2360
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2361 if (b->present) {
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2362 if ((gs = find_group_show(g->name)) == NULL)
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2363 gs = new_group_show(g->name);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2364 if ((bs = find_buddy_show(gs, b->name)) == NULL)
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
2365 bs = new_buddy_show(gs, b, (char **)login_icon_xpm);
2778
27c22147e023 [gaim-migrate @ 2791]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2736
diff changeset
2366 if (!g_slist_find(bs->connlist, gc)) {
1164
ed5bb86253c6 [gaim-migrate @ 1174]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1163
diff changeset
2367 bs->connlist = g_slist_append(bs->connlist, gc);
2778
27c22147e023 [gaim-migrate @ 2791]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2736
diff changeset
2368 update_num_group(gs);
27c22147e023 [gaim-migrate @ 2791]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2736
diff changeset
2369 }
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2370 if (b->present == 1) {
1299
18c3874ea051 [gaim-migrate @ 1309]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1297
diff changeset
2371 if (bs->sound != 2)
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 3059
diff changeset
2372 play_sound(SND_BUDDY_ARRIVE);
3192
3d2d57dba56b [gaim-migrate @ 3209]
Sean Egan <seanegan@gmail.com>
parents: 3189
diff changeset
2373 if (blist_options & OPT_BLIST_POPUP)
4280
57ab8f0a4263 [gaim-migrate @ 4531]
Luke Schierer <lschiere@pidgin.im>
parents: 4276
diff changeset
2374 gdk_window_show(blist->window);
1039
67ed2ee5be9f [gaim-migrate @ 1049]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1037
diff changeset
2375 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm,
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2376 NULL, (char **)login_icon_xpm);
1039
67ed2ee5be9f [gaim-migrate @ 1049]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1037
diff changeset
2377 gtk_widget_hide(bs->pix);
67ed2ee5be9f [gaim-migrate @ 1049]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1037
diff changeset
2378 gtk_pixmap_set(GTK_PIXMAP(bs->pix), pm, bm);
67ed2ee5be9f [gaim-migrate @ 1049]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1037
diff changeset
2379 gtk_widget_show(bs->pix);
67ed2ee5be9f [gaim-migrate @ 1049]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1037
diff changeset
2380 gdk_pixmap_unref(pm);
67ed2ee5be9f [gaim-migrate @ 1049]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1037
diff changeset
2381 gdk_bitmap_unref(bm);
121
3571b593f423 [gaim-migrate @ 131]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 120
diff changeset
2382 b->present = 2;
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
2383 if (bs->log_timer > 0)
4168
ebfb80bbe1ed [gaim-migrate @ 4397]
Luke Schierer <lschiere@pidgin.im>
parents: 4167
diff changeset
2384 g_source_remove(bs->log_timer);
ebfb80bbe1ed [gaim-migrate @ 4397]
Luke Schierer <lschiere@pidgin.im>
parents: 4167
diff changeset
2385 bs->log_timer = g_timeout_add(10000, log_timeout, bs);
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2281
diff changeset
2386 if ((bs->sound != 2) && (im_options & OPT_IM_LOGON)) {
1066
d6c70d58a4b2 [gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1063
diff changeset
2387 struct conversation *c = find_conversation(b->name);
d6c70d58a4b2 [gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1063
diff changeset
2388 if (c) {
d6c70d58a4b2 [gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1063
diff changeset
2389 char tmp[1024];
4227
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
2390 g_snprintf(tmp, sizeof(tmp), _("%s logged in."),
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
2391 get_buddy_alias(b));
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2824
diff changeset
2392 write_to_conv(c, tmp, WFLAG_SYSTEM, NULL, time(NULL), -1);
4167
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
2393 } else if (clistqueue && find_queue_total_by_name(b->name)) {
2906
538c58b43eff [gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2886
diff changeset
2394 struct queued_message *qm = g_new0(struct queued_message, 1);
2979
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2920
diff changeset
2395 g_snprintf(qm->name, sizeof(qm->name), "%s", b->name);
4227
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
2396 qm->message = g_strdup_printf(_("%s logged in."),
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
2397 get_buddy_alias(b));
2906
538c58b43eff [gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2886
diff changeset
2398 qm->gc = gc;
538c58b43eff [gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2886
diff changeset
2399 qm->tm = time(NULL);
538c58b43eff [gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2886
diff changeset
2400 qm->flags = WFLAG_SYSTEM;
538c58b43eff [gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2886
diff changeset
2401 qm->len = -1;
538c58b43eff [gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2886
diff changeset
2402 message_queue = g_slist_append(message_queue, qm);
1066
d6c70d58a4b2 [gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1063
diff changeset
2403 }
d6c70d58a4b2 [gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1063
diff changeset
2404 }
1661
6cea395b627d [gaim-migrate @ 1671]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1634
diff changeset
2405 bs->sound = 2;
1098
b335c0ce305e [gaim-migrate @ 1108]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1097
diff changeset
2406 } else if (bs->log_timer == 0) {
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2407 if (gc->prpl->list_icon)
2662
b0c5770156e1 [gaim-migrate @ 2675]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2641
diff changeset
2408 xpm = gc->prpl->list_icon(b->uc);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2409 if (xpm == NULL)
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2410 xpm = (char **)no_icon_xpm;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2411 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
2412 gtk_widget_hide(bs->pix);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2413 gtk_pixmap_set(GTK_PIXMAP(bs->pix), pm, bm);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2414 gtk_widget_show(bs->pix);
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2281
diff changeset
2415 if (!(blist_options & OPT_BLIST_SHOW_PIXMAPS))
1711
9b86520e04ac [gaim-migrate @ 1721]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1699
diff changeset
2416 gtk_widget_hide(bs->pix);
644
b3900e312d8e [gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 608
diff changeset
2417 gdk_pixmap_unref(pm);
804
17def2bb9720 [gaim-migrate @ 814]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 803
diff changeset
2418 gdk_bitmap_unref(bm);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2419 }
1058
4927ce25d8cc [gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
2420 update_idle_time(bs);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2421 } else {
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2422 gs = find_group_show(g->name);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2423 if (!gs)
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2424 return;
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2425 bs = find_buddy_show(gs, b->name);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2426 if (!bs)
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2427 return;
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2428 if (!bs->connlist)
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2429 return; /* we won't do signoff updates for
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2430 buddies that have already signed
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2431 off */
1299
18c3874ea051 [gaim-migrate @ 1309]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1297
diff changeset
2432 if (bs->sound != 1)
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 3059
diff changeset
2433 play_sound(SND_BUDDY_LEAVE);
3192
3d2d57dba56b [gaim-migrate @ 3209]
Sean Egan <seanegan@gmail.com>
parents: 3189
diff changeset
2434 if (blist_options & OPT_BLIST_POPUP)
4280
57ab8f0a4263 [gaim-migrate @ 4531]
Luke Schierer <lschiere@pidgin.im>
parents: 4276
diff changeset
2435 gdk_window_show(blist->window);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2436 bs->connlist = g_slist_remove(bs->connlist, gc);
2778
27c22147e023 [gaim-migrate @ 2791]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2736
diff changeset
2437 update_num_group(gs);
1032
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
2438 if (bs->log_timer > 0)
4168
ebfb80bbe1ed [gaim-migrate @ 4397]
Luke Schierer <lschiere@pidgin.im>
parents: 4167
diff changeset
2439 g_source_remove(bs->log_timer);
ebfb80bbe1ed [gaim-migrate @ 4397]
Luke Schierer <lschiere@pidgin.im>
parents: 4167
diff changeset
2440 bs->log_timer = g_timeout_add(10000, log_timeout, bs);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2441 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
2442 gtk_widget_hide(bs->pix);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2443 gtk_pixmap_set(GTK_PIXMAP(bs->pix), pm, bm);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2444 gtk_widget_show(bs->pix);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2445 gdk_pixmap_unref(pm);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2446 gdk_bitmap_unref(bm);
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2281
diff changeset
2447 if ((bs->sound != 1) && (im_options & OPT_IM_LOGON)) {
1066
d6c70d58a4b2 [gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1063
diff changeset
2448 struct conversation *c = find_conversation(b->name);
d6c70d58a4b2 [gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1063
diff changeset
2449 if (c) {
d6c70d58a4b2 [gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1063
diff changeset
2450 char tmp[1024];
4227
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
2451 g_snprintf(tmp, sizeof(tmp), _("%s logged out."),
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
2452 get_buddy_alias(b));
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2824
diff changeset
2453 write_to_conv(c, tmp, WFLAG_SYSTEM, NULL, time(NULL), -1);
4167
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
2454 } else if (clistqueue && find_queue_total_by_name(b->name)) {
2906
538c58b43eff [gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2886
diff changeset
2455 struct queued_message *qm = g_new0(struct queued_message, 1);
4227
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
2456 g_snprintf(qm->name, sizeof(qm->name), "%s",
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
2457 get_buddy_alias(b));
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
2458 qm->message = g_strdup_printf(_("%s logged out."),
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4172
diff changeset
2459 get_buddy_alias(b));
2906
538c58b43eff [gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2886
diff changeset
2460 qm->gc = gc;
538c58b43eff [gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2886
diff changeset
2461 qm->tm = time(NULL);
538c58b43eff [gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2886
diff changeset
2462 qm->flags = WFLAG_SYSTEM;
538c58b43eff [gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2886
diff changeset
2463 qm->len = -1;
538c58b43eff [gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2886
diff changeset
2464 message_queue = g_slist_append(message_queue, qm);
1066
d6c70d58a4b2 [gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1063
diff changeset
2465 }
d6c70d58a4b2 [gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1063
diff changeset
2466 }
1661
6cea395b627d [gaim-migrate @ 1671]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1634
diff changeset
2467
6cea395b627d [gaim-migrate @ 1671]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1634
diff changeset
2468 bs->sound = 1;
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2469 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2470 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2471
3540
785292d72aed [gaim-migrate @ 3615]
Luke Schierer <lschiere@pidgin.im>
parents: 3539
diff changeset
2472 static void configure_blist_window(GtkWidget *w, GdkEventConfigure *event, void *data) {
4108
274cb26ba8dc [gaim-migrate @ 4323]
Luke Schierer <lschiere@pidgin.im>
parents: 4082
diff changeset
2473 /* unfortunately GdkEventConfigure ignores the window gravity, but *
274cb26ba8dc [gaim-migrate @ 4323]
Luke Schierer <lschiere@pidgin.im>
parents: 4082
diff changeset
2474 * the only way we have of setting the position doesn't. we have to *
274cb26ba8dc [gaim-migrate @ 4323]
Luke Schierer <lschiere@pidgin.im>
parents: 4082
diff changeset
2475 * call get_position and get_size because they do pay attention to *
274cb26ba8dc [gaim-migrate @ 4323]
Luke Schierer <lschiere@pidgin.im>
parents: 4082
diff changeset
2476 * the gravity. this is inefficient and I agree it sucks, but it's *
274cb26ba8dc [gaim-migrate @ 4323]
Luke Schierer <lschiere@pidgin.im>
parents: 4082
diff changeset
2477 * more likely to work correctly. - Robot101 */
4109
4efc492cf16f [gaim-migrate @ 4324]
Luke Schierer <lschiere@pidgin.im>
parents: 4108
diff changeset
2478 gint x, y;
4108
274cb26ba8dc [gaim-migrate @ 4323]
Luke Schierer <lschiere@pidgin.im>
parents: 4082
diff changeset
2479
274cb26ba8dc [gaim-migrate @ 4323]
Luke Schierer <lschiere@pidgin.im>
parents: 4082
diff changeset
2480 gtk_window_get_position(GTK_WINDOW(blist), &x, &y);
274cb26ba8dc [gaim-migrate @ 4323]
Luke Schierer <lschiere@pidgin.im>
parents: 4082
diff changeset
2481
274cb26ba8dc [gaim-migrate @ 4323]
Luke Schierer <lschiere@pidgin.im>
parents: 4082
diff changeset
2482 if (x != blist_pos.x ||
274cb26ba8dc [gaim-migrate @ 4323]
Luke Schierer <lschiere@pidgin.im>
parents: 4082
diff changeset
2483 y != blist_pos.y ||
4109
4efc492cf16f [gaim-migrate @ 4324]
Luke Schierer <lschiere@pidgin.im>
parents: 4108
diff changeset
2484 event->width != blist_pos.width ||
4efc492cf16f [gaim-migrate @ 4324]
Luke Schierer <lschiere@pidgin.im>
parents: 4108
diff changeset
2485 event->height != blist_pos.height) {
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4155
diff changeset
2486 blist_pos.x = x;
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4155
diff changeset
2487 blist_pos.y = y;
4109
4efc492cf16f [gaim-migrate @ 4324]
Luke Schierer <lschiere@pidgin.im>
parents: 4108
diff changeset
2488 blist_pos.width = event->width;
4efc492cf16f [gaim-migrate @ 4324]
Luke Schierer <lschiere@pidgin.im>
parents: 4108
diff changeset
2489 blist_pos.height = event->height;
3540
785292d72aed [gaim-migrate @ 3615]
Luke Schierer <lschiere@pidgin.im>
parents: 3539
diff changeset
2490 save_prefs();
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2491 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2492 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2493
3939
49d42b275a68 [gaim-migrate @ 4115]
Luke Schierer <lschiere@pidgin.im>
parents: 3902
diff changeset
2494 static void visibility_blist_window(GtkWidget *w, GdkEventVisibility *event, void *data) {
49d42b275a68 [gaim-migrate @ 4115]
Luke Schierer <lschiere@pidgin.im>
parents: 3902
diff changeset
2495 if (event->state == GDK_VISIBILITY_FULLY_OBSCURED) {
49d42b275a68 [gaim-migrate @ 4115]
Luke Schierer <lschiere@pidgin.im>
parents: 3902
diff changeset
2496 obscured = TRUE;
49d42b275a68 [gaim-migrate @ 4115]
Luke Schierer <lschiere@pidgin.im>
parents: 3902
diff changeset
2497 } else {
49d42b275a68 [gaim-migrate @ 4115]
Luke Schierer <lschiere@pidgin.im>
parents: 3902
diff changeset
2498 obscured = FALSE;
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2499 }
3554
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
2500 }
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
2501
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2502 /*******************************************************************
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2503 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2504 * Helper funs for making the menu
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2505 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2506 *******************************************************************/
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2507
1499
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1496
diff changeset
2508 void gaim_separator(GtkWidget *menu)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2509 {
3878
31560d541b76 [gaim-migrate @ 4030]
Rob Flynn <gaim@robflynn.com>
parents: 3877
diff changeset
2510 GtkWidget *menuitem;
31560d541b76 [gaim-migrate @ 4030]
Rob Flynn <gaim@robflynn.com>
parents: 3877
diff changeset
2511
31560d541b76 [gaim-migrate @ 4030]
Rob Flynn <gaim@robflynn.com>
parents: 3877
diff changeset
2512 menuitem = gtk_separator_menu_item_new();
31560d541b76 [gaim-migrate @ 4030]
Rob Flynn <gaim@robflynn.com>
parents: 3877
diff changeset
2513 gtk_widget_show(menuitem);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2514 gtk_menu_append(GTK_MENU(menu), menuitem);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2515 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2516
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2517
696
97b75ed155b0 [gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 689
diff changeset
2518 void build_imchat_box(gboolean on)
97b75ed155b0 [gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 689
diff changeset
2519 {
97b75ed155b0 [gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 689
diff changeset
2520 if (on) {
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2521 if (imchatbox)
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2522 return;
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2523
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2524 imbutton = gtk_button_new_with_label(_("IM"));
696
97b75ed155b0 [gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 689
diff changeset
2525 infobutton = gtk_button_new_with_label(_("Info"));
97b75ed155b0 [gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 689
diff changeset
2526 chatbutton = gtk_button_new_with_label(_("Chat"));
1929
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
2527 awaybutton = gtk_button_new_with_label(_("Away"));
696
97b75ed155b0 [gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 689
diff changeset
2528
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2529 imchatbox = gtk_hbox_new(TRUE, 10);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2530
3902
22ed8423a964 [gaim-migrate @ 4055]
Rob Flynn <gaim@robflynn.com>
parents: 3894
diff changeset
2531 gtk_button_set_relief(GTK_BUTTON(imbutton), GTK_RELIEF_NONE);
22ed8423a964 [gaim-migrate @ 4055]
Rob Flynn <gaim@robflynn.com>
parents: 3894
diff changeset
2532 gtk_button_set_relief(GTK_BUTTON(infobutton), GTK_RELIEF_NONE);
22ed8423a964 [gaim-migrate @ 4055]
Rob Flynn <gaim@robflynn.com>
parents: 3894
diff changeset
2533 gtk_button_set_relief(GTK_BUTTON(chatbutton), GTK_RELIEF_NONE);
22ed8423a964 [gaim-migrate @ 4055]
Rob Flynn <gaim@robflynn.com>
parents: 3894
diff changeset
2534 gtk_button_set_relief(GTK_BUTTON(awaybutton), GTK_RELIEF_NONE);
696
97b75ed155b0 [gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 689
diff changeset
2535
97b75ed155b0 [gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 689
diff changeset
2536 /* Put the buttons in the hbox */
97b75ed155b0 [gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 689
diff changeset
2537 gtk_widget_show(imbutton);
1929
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
2538 gtk_widget_show(infobutton);
696
97b75ed155b0 [gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 689
diff changeset
2539 gtk_widget_show(chatbutton);
1929
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
2540 gtk_widget_show(awaybutton);
696
97b75ed155b0 [gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 689
diff changeset
2541
97b75ed155b0 [gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 689
diff changeset
2542 gtk_box_pack_start(GTK_BOX(imchatbox), imbutton, TRUE, TRUE, 0);
97b75ed155b0 [gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 689
diff changeset
2543 gtk_box_pack_start(GTK_BOX(imchatbox), infobutton, TRUE, TRUE, 0);
97b75ed155b0 [gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 689
diff changeset
2544 gtk_box_pack_start(GTK_BOX(imchatbox), chatbutton, TRUE, TRUE, 0);
1929
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
2545 gtk_box_pack_start(GTK_BOX(imchatbox), awaybutton, TRUE, TRUE, 0);
1172
4135d8fc7b4e [gaim-migrate @ 1182]
Rob Flynn <gaim@robflynn.com>
parents: 1171
diff changeset
2546 gtk_container_border_width(GTK_CONTAINER(imchatbox), 5);
696
97b75ed155b0 [gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 689
diff changeset
2547
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
2548 g_signal_connect(GTK_OBJECT(imbutton), "clicked", G_CALLBACK(im_callback),
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2549 buddies);
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
2550 g_signal_connect(GTK_OBJECT(infobutton), "clicked", G_CALLBACK(info_callback),
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2551 buddies);
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
2552 g_signal_connect(GTK_OBJECT(chatbutton), "clicked", G_CALLBACK(chat_callback),
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2553 buddies);
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
2554 g_signal_connect(GTK_OBJECT(awaybutton), "clicked", G_CALLBACK(away_callback),
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2555 buddies);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2556
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2557 gtk_tooltips_set_tip(tips, infobutton, _("Information on selected Buddy"), "Penguin");
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2558 gtk_tooltips_set_tip(tips, imbutton, _("Send Instant Message"), "Penguin");
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2559 gtk_tooltips_set_tip(tips, chatbutton, _("Start/join a Buddy Chat"), "Penguin");
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2560 gtk_tooltips_set_tip(tips, awaybutton, _("Activate Away Message"), "Penguin");
696
97b75ed155b0 [gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 689
diff changeset
2561
97b75ed155b0 [gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 689
diff changeset
2562 gtk_box_pack_start(GTK_BOX(buddypane), imchatbox, FALSE, FALSE, 0);
97b75ed155b0 [gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 689
diff changeset
2563
97b75ed155b0 [gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 689
diff changeset
2564 gtk_widget_show(imchatbox);
97b75ed155b0 [gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 689
diff changeset
2565 } else {
97b75ed155b0 [gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 689
diff changeset
2566 if (imchatbox)
97b75ed155b0 [gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 689
diff changeset
2567 gtk_widget_destroy(imchatbox);
97b75ed155b0 [gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 689
diff changeset
2568 imchatbox = NULL;
97b75ed155b0 [gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 689
diff changeset
2569 }
97b75ed155b0 [gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 689
diff changeset
2570 }
97b75ed155b0 [gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 689
diff changeset
2571
3204
20769d05df16 [gaim-migrate @ 3221]
Sean Egan <seanegan@gmail.com>
parents: 3202
diff changeset
2572 extern GtkWidget *debugbutton;
20769d05df16 [gaim-migrate @ 3221]
Sean Egan <seanegan@gmail.com>
parents: 3202
diff changeset
2573 void clicked_debug (GtkWidget *widg, gpointer pntr)
20769d05df16 [gaim-migrate @ 3221]
Sean Egan <seanegan@gmail.com>
parents: 3202
diff changeset
2574 {
20769d05df16 [gaim-migrate @ 3221]
Sean Egan <seanegan@gmail.com>
parents: 3202
diff changeset
2575 if (debugbutton)
20769d05df16 [gaim-migrate @ 3221]
Sean Egan <seanegan@gmail.com>
parents: 3202
diff changeset
2576 gtk_button_clicked(GTK_BUTTON(debugbutton));
20769d05df16 [gaim-migrate @ 3221]
Sean Egan <seanegan@gmail.com>
parents: 3202
diff changeset
2577 else {
20769d05df16 [gaim-migrate @ 3221]
Sean Egan <seanegan@gmail.com>
parents: 3202
diff changeset
2578 misc_options ^= OPT_MISC_DEBUG;
20769d05df16 [gaim-migrate @ 3221]
Sean Egan <seanegan@gmail.com>
parents: 3202
diff changeset
2579 show_debug();
20769d05df16 [gaim-migrate @ 3221]
Sean Egan <seanegan@gmail.com>
parents: 3202
diff changeset
2580 }
20769d05df16 [gaim-migrate @ 3221]
Sean Egan <seanegan@gmail.com>
parents: 3202
diff changeset
2581 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2582
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2583 void make_buddy_list()
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2584 {
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2585
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2586 /* Build the buddy list, based on *config */
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2587
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2588 GtkWidget *sw;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2589 GtkWidget *menu;
1499
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1496
diff changeset
2590 #ifdef NO_MULTI
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2591 GtkWidget *setmenu;
1499
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1496
diff changeset
2592 GtkWidget *findmenu;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1496
diff changeset
2593 #endif
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2594 GtkWidget *menubar;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2595 GtkWidget *vbox;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2596 GtkWidget *menuitem;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2597 GtkWidget *notebook;
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2598 GtkWidget *label;
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2599 GtkWidget *bbox;
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2600 GtkWidget *tbox;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2601
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 945
diff changeset
2602 if (blist) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 945
diff changeset
2603 return;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 945
diff changeset
2604 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 945
diff changeset
2605
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2606 blist = gtk_window_new(GTK_WINDOW_TOPLEVEL);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2607
4167
7002b6f16bdf [gaim-migrate @ 4396]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
2608 gtk_window_set_gravity(GTK_WINDOW(blist), GDK_GRAVITY_NORTH_WEST);
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2609 gtk_window_set_policy(GTK_WINDOW(blist), TRUE, TRUE, TRUE);
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2610 gtk_window_set_title(GTK_WINDOW(blist), _("Gaim - Buddy List"));
4074
3ccbdf8e7f8d [gaim-migrate @ 4289]
Sean Egan <seanegan@gmail.com>
parents: 4064
diff changeset
2611 gtk_window_set_role(GTK_WINDOW(blist), "buddy_list");
905
2876c40108cd [gaim-migrate @ 915]
Rob Flynn <gaim@robflynn.com>
parents: 903
diff changeset
2612
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2613 gtk_widget_realize(blist);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2614
1634
d029dc28a61e [gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1625
diff changeset
2615 accel = gtk_accel_group_new();
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2616 gtk_window_add_accel_group(GTK_WINDOW(blist), accel);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2617
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2618 menubar = gtk_menu_bar_new();
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2619
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2620 menu = gtk_menu_new();
1634
d029dc28a61e [gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1625
diff changeset
2621 gtk_menu_set_accel_group(GTK_MENU(menu), accel);
d029dc28a61e [gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1625
diff changeset
2622
d029dc28a61e [gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1625
diff changeset
2623 menuitem = gaim_new_item(NULL, _("File"));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2624 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2625 gtk_menu_bar_append(GTK_MENU_BAR(menubar), menuitem);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2626
3879
745e8582a7f7 [gaim-migrate @ 4031]
Rob Flynn <gaim@robflynn.com>
parents: 3878
diff changeset
2627 gaim_new_item_from_stock(menu, _("_Add A Buddy"), GTK_STOCK_ADD,
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
2628 G_CALLBACK(add_buddy_callback), NULL, 'b', GDK_CONTROL_MASK, "Ctl+B");
3879
745e8582a7f7 [gaim-migrate @ 4031]
Rob Flynn <gaim@robflynn.com>
parents: 3878
diff changeset
2629 gaim_new_item_from_stock(menu, _("_Join A Chat"), GTK_STOCK_JUMP_TO,
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
2630 G_CALLBACK(chat_callback), NULL, 'c', GDK_CONTROL_MASK, "Ctl+C");
3879
745e8582a7f7 [gaim-migrate @ 4031]
Rob Flynn <gaim@robflynn.com>
parents: 3878
diff changeset
2631 gaim_new_item_from_stock(menu, _("_New Message"), GTK_STOCK_CONVERT,
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
2632 G_CALLBACK(show_im_dialog), NULL, 'i', GDK_CONTROL_MASK, "Ctl+I");
3879
745e8582a7f7 [gaim-migrate @ 4031]
Rob Flynn <gaim@robflynn.com>
parents: 3878
diff changeset
2633 gaim_new_item_from_stock(menu, _("_Get User Info"), GTK_STOCK_FIND,
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
2634 G_CALLBACK(show_info_dialog), NULL, 'j', GDK_CONTROL_MASK, "Ctl+J");
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2635
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2636 gaim_separator(menu);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2637
3881
b10f36aa0b18 [gaim-migrate @ 4033]
Rob Flynn <gaim@robflynn.com>
parents: 3880
diff changeset
2638 gaim_new_item_from_pixbuf(menu, _("Import Buddy List"), "import-menu.png",
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
2639 G_CALLBACK(import_callback), NULL, 0, 0, 0);
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2640
1499
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1496
diff changeset
2641 gaim_separator(menu);
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2642
3872
71ccf763f082 [gaim-migrate @ 4024]
Rob Flynn <gaim@robflynn.com>
parents: 3869
diff changeset
2643 gaim_new_item_from_stock(menu, _("Signoff"), NULL,
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
2644 G_CALLBACK(signoff_all), (void*)1, 'd', GDK_CONTROL_MASK, "Ctl+D");
3872
71ccf763f082 [gaim-migrate @ 4024]
Rob Flynn <gaim@robflynn.com>
parents: 3869
diff changeset
2645 gaim_new_item_from_stock(menu, _("Hide"), NULL,
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
2646 G_CALLBACK(hide_buddy_list), NULL, 'h', GDK_CONTROL_MASK, "Ctl+H");
3872
71ccf763f082 [gaim-migrate @ 4024]
Rob Flynn <gaim@robflynn.com>
parents: 3869
diff changeset
2647 gaim_new_item_from_stock(menu, _("Quit"), GTK_STOCK_QUIT,
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
2648 G_CALLBACK(do_quit), NULL, 'q', GDK_CONTROL_MASK, "Ctl+Q");
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2649
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2650 menu = gtk_menu_new();
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2651
1634
d029dc28a61e [gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1625
diff changeset
2652 menuitem = gaim_new_item(NULL, _("Tools"));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2653 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2654 gtk_menu_bar_append(GTK_MENU_BAR(menubar), menuitem);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2655
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2656 awaymenu = gtk_menu_new();
3876
c634bc29bf20 [gaim-migrate @ 4028]
Rob Flynn <gaim@robflynn.com>
parents: 3875
diff changeset
2657 menuitem = gaim_new_item_from_stock(menu, _("Away"), NULL, NULL, NULL, 0, 0, 0);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2658 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), awaymenu);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2659 do_away_menu();
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2660
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2661 bpmenu = gtk_menu_new();
3876
c634bc29bf20 [gaim-migrate @ 4028]
Rob Flynn <gaim@robflynn.com>
parents: 3875
diff changeset
2662 menuitem = gaim_new_item_from_stock(menu, _("Buddy Pounce"), NULL, NULL, NULL, 0, 0, 0);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2663 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), bpmenu);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2664 do_bp_menu();
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2665
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2666 gaim_separator(menu);
1499
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1496
diff changeset
2667
2598
b2800bca74fe [gaim-migrate @ 2611]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2592
diff changeset
2668 #ifndef NO_MULTI
3883
2049abe74a63 [gaim-migrate @ 4035]
Rob Flynn <gaim@robflynn.com>
parents: 3882
diff changeset
2669 gaim_new_item_from_pixbuf(menu, _("_Accounts..."), "accounts-menu.png",
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
2670 G_CALLBACK(account_editor), NULL, 'a', GDK_CONTROL_MASK, "Ctl+A");
2598
b2800bca74fe [gaim-migrate @ 2611]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2592
diff changeset
2671 #endif
3879
745e8582a7f7 [gaim-migrate @ 4031]
Rob Flynn <gaim@robflynn.com>
parents: 3878
diff changeset
2672 gaim_new_item_from_stock(menu, _("_Preferences..."), GTK_STOCK_PREFERENCES,
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
2673 G_CALLBACK(show_prefs), NULL, 'p', GDK_CONTROL_MASK, "Ctl+P");
3877
d8056e48eb52 [gaim-migrate @ 4029]
Rob Flynn <gaim@robflynn.com>
parents: 3876
diff changeset
2674
d8056e48eb52 [gaim-migrate @ 4029]
Rob Flynn <gaim@robflynn.com>
parents: 3876
diff changeset
2675 gaim_separator(menu);
1499
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1496
diff changeset
2676
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1496
diff changeset
2677 protomenu = gtk_menu_new();
3876
c634bc29bf20 [gaim-migrate @ 4028]
Rob Flynn <gaim@robflynn.com>
parents: 3875
diff changeset
2678 menuitem = gaim_new_item_from_stock(menu, _("Protocol Actions"), NULL, NULL, NULL, 0, 0, 0);
1499
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1496
diff changeset
2679 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), protomenu);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1496
diff changeset
2680 do_proto_menu();
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2681
3879
745e8582a7f7 [gaim-migrate @ 4031]
Rob Flynn <gaim@robflynn.com>
parents: 3878
diff changeset
2682 gaim_new_item_from_stock(menu, _("Pr_ivacy..."), NULL,
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
2683 G_CALLBACK(show_privacy_options), NULL, 0, 0, 0);
3877
d8056e48eb52 [gaim-migrate @ 4029]
Rob Flynn <gaim@robflynn.com>
parents: 3876
diff changeset
2684
3879
745e8582a7f7 [gaim-migrate @ 4031]
Rob Flynn <gaim@robflynn.com>
parents: 3878
diff changeset
2685 gaim_new_item_from_stock(menu, _("_View System Log..."), NULL,
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
2686 G_CALLBACK(show_syslog), NULL, 0, 0, 0);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 87
diff changeset
2687
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2688 menu = gtk_menu_new();
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2689
1634
d029dc28a61e [gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1625
diff changeset
2690 menuitem = gaim_new_item(NULL, _("Help"));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2691 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2692 gtk_menu_bar_append(GTK_MENU_BAR(menubar), menuitem);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2693
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
2694 gaim_new_item_from_stock(menu, _("Online Help"), GTK_STOCK_HELP, G_CALLBACK(open_url), WEBSITE"documentation.php", GDK_F1, 0, NULL);
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
2695 gaim_new_item_from_stock(menu, _("Debug Window"), NULL, G_CALLBACK(clicked_debug), NULL, 0, 0, NULL);
3882
cb3dc3899176 [gaim-migrate @ 4034]
Rob Flynn <gaim@robflynn.com>
parents: 3881
diff changeset
2696
cb3dc3899176 [gaim-migrate @ 4034]
Rob Flynn <gaim@robflynn.com>
parents: 3881
diff changeset
2697 gaim_separator(menu);
cb3dc3899176 [gaim-migrate @ 4034]
Rob Flynn <gaim@robflynn.com>
parents: 3881
diff changeset
2698
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
2699 gaim_new_item_from_pixbuf(menu, _("About Gaim"), "about_menu.png", G_CALLBACK(show_about), NULL, GDK_F1, GDK_CONTROL_MASK, NULL);
3204
20769d05df16 [gaim-migrate @ 3221]
Sean Egan <seanegan@gmail.com>
parents: 3202
diff changeset
2700
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2701 gtk_widget_show(menubar);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2702
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2703 vbox = gtk_vbox_new(FALSE, 0);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2704
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2705 notebook = gtk_notebook_new();
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2706
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2707 /* Do buddy list stuff */
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2708 /* FIXME: spacing on both panes is ad hoc */
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2709 buddypane = gtk_vbox_new(FALSE, 1);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2710
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2711 buddies = gtk_tree_new();
3131
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
2712 gtk_tree_set_view_lines(GTK_TREE(buddies), FALSE);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2713 sw = gtk_scrolled_window_new(NULL, NULL);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2714
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2715 tips = gtk_tooltips_new();
350
fd3cc0a28d5d [gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
2716 gtk_object_set_data(GTK_OBJECT(blist), _("Buddy List"), tips);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2717
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2718 /* Now the buddy list */
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2719 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), buddies);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2720 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2721 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2722 gtk_widget_set_usize(sw, 200, 200);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2723 gtk_widget_show(buddies);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2724 gtk_widget_show(sw);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2725
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2726 gtk_box_pack_start(GTK_BOX(buddypane), sw, TRUE, TRUE, 0);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2727 gtk_widget_show(buddypane);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2728
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2281
diff changeset
2729 if (!(blist_options & OPT_BLIST_NO_BUTTONS))
696
97b75ed155b0 [gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 689
diff changeset
2730 build_imchat_box(TRUE);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2731
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2732 /* Swing the edit buddy */
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2733 editpane = gtk_vbox_new(FALSE, 1);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2734
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2735 edittree = gtk_ctree_new(1, 0);
3152
0697a3ad9f3b [gaim-migrate @ 3168]
Rob Flynn <gaim@robflynn.com>
parents: 3137
diff changeset
2736 gtk_ctree_set_line_style(GTK_CTREE(edittree), GTK_CTREE_LINES_SOLID);;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2737 gtk_ctree_set_expander_style(GTK_CTREE(edittree), GTK_CTREE_EXPANDER_SQUARE);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2738 gtk_clist_set_reorderable(GTK_CLIST(edittree), TRUE);
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
2739 g_signal_connect(GTK_OBJECT(edittree), "button_press_event",
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
2740 G_CALLBACK(click_edit_tree), NULL);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2741
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2742 gtk_ctree_set_drag_compare_func(GTK_CTREE(edittree),
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2743 (GtkCTreeCompareDragFunc) edit_drag_compare_func);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2744
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2745
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
2746 g_signal_connect_after(GTK_OBJECT(edittree), "tree_move",
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
2747 G_CALLBACK(edit_tree_move), NULL);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2748
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2749
1172
4135d8fc7b4e [gaim-migrate @ 1182]
Rob Flynn <gaim@robflynn.com>
parents: 1171
diff changeset
2750 bbox = gtk_hbox_new(TRUE, 5);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2751 gtk_container_set_border_width(GTK_CONTAINER(bbox), 5);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2752 tbox = gtk_scrolled_window_new(NULL, NULL);
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2753
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2754 /* buttons */
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2755 addbutton = gtk_button_new_with_label(_("Add"));
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2756 groupbutton = gtk_button_new_with_label(_("Group"));
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2757 rembutton = gtk_button_new_with_label(_("Remove"));
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2758
3902
22ed8423a964 [gaim-migrate @ 4055]
Rob Flynn <gaim@robflynn.com>
parents: 3894
diff changeset
2759 gtk_button_set_relief(GTK_BUTTON(addbutton), GTK_RELIEF_NONE);
22ed8423a964 [gaim-migrate @ 4055]
Rob Flynn <gaim@robflynn.com>
parents: 3894
diff changeset
2760 gtk_button_set_relief(GTK_BUTTON(groupbutton), GTK_RELIEF_NONE);
22ed8423a964 [gaim-migrate @ 4055]
Rob Flynn <gaim@robflynn.com>
parents: 3894
diff changeset
2761 gtk_button_set_relief(GTK_BUTTON(rembutton), GTK_RELIEF_NONE);
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2762
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2763 gtk_box_pack_start(GTK_BOX(bbox), addbutton, TRUE, TRUE, 0);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2764 gtk_box_pack_start(GTK_BOX(bbox), groupbutton, TRUE, TRUE, 0);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2765 gtk_box_pack_start(GTK_BOX(bbox), rembutton, TRUE, TRUE, 0);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2766
350
fd3cc0a28d5d [gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
2767 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
2768 gtk_tooltips_set_tip(tips, groupbutton, _("Add a new Group"), "Penguin");
2134
6641141234b7 [gaim-migrate @ 2144]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2132
diff changeset
2769 gtk_tooltips_set_tip(tips, rembutton, _("Remove selected Buddy/Group"), "Penguin");
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2770
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2771 g_signal_connect(G_OBJECT(rembutton), "clicked", G_CALLBACK(do_del_buddy), edittree);
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2772 g_signal_connect(G_OBJECT(addbutton), "clicked", G_CALLBACK(add_buddy_callback), NULL);
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2773 g_signal_connect(G_OBJECT(groupbutton), "clicked", G_CALLBACK(add_group_callback), NULL);
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2774
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2775 /* And the boxes in the box */
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2776 gtk_box_pack_start(GTK_BOX(editpane), tbox, TRUE, TRUE, 0);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2777 gtk_box_pack_start(GTK_BOX(editpane), bbox, FALSE, FALSE, 0);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2778
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2779 /* Finish up */
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2780 gtk_widget_show(addbutton);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2781 gtk_widget_show(groupbutton);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2782 gtk_widget_show(rembutton);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2783 gtk_widget_show(edittree);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2784 gtk_widget_show(tbox);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2785 gtk_widget_show(bbox);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2786 gtk_widget_show(editpane);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2787
703
20553b584ccb [gaim-migrate @ 713]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 700
diff changeset
2788 update_button_pix();
20553b584ccb [gaim-migrate @ 713]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 700
diff changeset
2789
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2790 label = gtk_label_new(_("Online"));
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2791 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), buddypane, label);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2792 label = gtk_label_new(_("Edit Buddies"));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2793 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), editpane, label);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2794
3032
d3536105d581 [gaim-migrate @ 3045]
Rob Flynn <gaim@robflynn.com>
parents: 2993
diff changeset
2795 if(blist_options & OPT_BLIST_BOTTOM_TAB)
d3536105d581 [gaim-migrate @ 3045]
Rob Flynn <gaim@robflynn.com>
parents: 2993
diff changeset
2796 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_BOTTOM);
d3536105d581 [gaim-migrate @ 3045]
Rob Flynn <gaim@robflynn.com>
parents: 2993
diff changeset
2797
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2798 gtk_widget_show_all(notebook);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2799
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2800 /* Pack things in the vbox */
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2801 gtk_widget_show(vbox);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2802 gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2803 gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2804 gtk_container_add(GTK_CONTAINER(blist), vbox);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2805
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2806 g_signal_connect(G_OBJECT(blist), "delete_event", G_CALLBACK(close_buddy_list), NULL);
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2807 g_signal_connect(G_OBJECT(blist), "configure_event", G_CALLBACK(configure_blist_window), NULL);
3939
49d42b275a68 [gaim-migrate @ 4115]
Luke Schierer <lschiere@pidgin.im>
parents: 3902
diff changeset
2808 g_signal_connect(G_OBJECT(blist), "visibility_notify_event", G_CALLBACK(visibility_blist_window), NULL);
49d42b275a68 [gaim-migrate @ 4115]
Luke Schierer <lschiere@pidgin.im>
parents: 3902
diff changeset
2809
49d42b275a68 [gaim-migrate @ 4115]
Luke Schierer <lschiere@pidgin.im>
parents: 3902
diff changeset
2810 gtk_widget_add_events(blist, GDK_VISIBILITY_NOTIFY_MASK);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2811
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2812 /* The edit tree */
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2813 gtk_container_add(GTK_CONTAINER(tbox), edittree);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2814 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(tbox),
3558
ea617b23ddac [gaim-migrate @ 3651]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
2815 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
2816
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
2817 #ifdef _WIN32
3948
40258b6b5ecf [gaim-migrate @ 4127]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3939
diff changeset
2818 /* Register newly created window with systray module */
40258b6b5ecf [gaim-migrate @ 4127]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3939
diff changeset
2819 wgaim_created_blistwin(GTK_WIDGET(blist));
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
2820 #endif
4239
9b40fa57a8ed [gaim-migrate @ 4487]
Luke Schierer <lschiere@pidgin.im>
parents: 4227
diff changeset
2821
9b40fa57a8ed [gaim-migrate @ 4487]
Luke Schierer <lschiere@pidgin.im>
parents: 4227
diff changeset
2822 /* Houston, we are go for launch. */
9b40fa57a8ed [gaim-migrate @ 4487]
Luke Schierer <lschiere@pidgin.im>
parents: 4227
diff changeset
2823 unhide_buddy_list();
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2824 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2825
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2826 void show_buddy_list()
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2827 {
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3568
diff changeset
2828 make_buddy_list();
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2829 build_edit_tree();
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2830 update_button_pix();
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2831 }