annotate src/pounce.c @ 4841:7bdda84b5431

[gaim-migrate @ 5166] This fixes the bug where people would show up as being online for 47 thousand days in their mouse overs. To all the people that experienced this bug: Set the clocks on your computers correctly, foos. And now some quotes: Good versus evil equals confrontation Good turned to evil and a push comes to shove, we must save the world with an act of love "How could you not love it? This buddy list is endangering marriages." committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 20 Mar 2003 21:13:07 +0000
parents 677d3cb193a1
children cb700c07ee07
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /*
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2 * gaim
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 *
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4 * Copyright (C) 1998-2003, Mark Spencer <markster@marko.net>
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5 *
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * (at your option) any later version.
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 *
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * GNU General Public License for more details.
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 *
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 *
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 #include <stdlib.h>
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 #include <string.h>
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
24 #include <sys/types.h>
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 #include <unistd.h>
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27 #include "gaim.h"
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28 #include "prpl.h"
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 #include "pounce.h"
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 GtkWidget *bpmenu = NULL;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 void rem_bp(GtkWidget *w, struct buddy_pounce *b)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34 {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35 buddy_pounces = g_list_remove(buddy_pounces, b);
4696
abec345c8c92 [gaim-migrate @ 5007]
Nathan Walp <nwalp@pidgin.im>
parents: 4690
diff changeset
36 do_bp_menu();
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37 save_prefs();
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40 void do_pounce(struct gaim_connection *gc, char *name, int when)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41 {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42 char *who;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44 struct buddy_pounce *b;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45 struct gaim_conversation *c;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46 struct gaim_account *account;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48 GList *bp = buddy_pounces;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50 who = g_strdup(normalize (name));
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52 while (bp) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53 b = (struct buddy_pounce *)bp->data;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54 bp = bp->next; /* increment the list here because rem_bp can make our handle bad */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
56 if (!(b->options & when))
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57 continue;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59 account = gaim_account_find(b->pouncer, b->protocol); /* find our user */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60 if (account == NULL)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
61 continue;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
62
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
63 /* check and see if we're signed on as the pouncer */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
64 if (account->gc != gc)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65 continue;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
66
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4772
diff changeset
67 if (!gaim_utf8_strcasecmp(who, normalize (b->name))) { /* find someone to pounce */
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
68 if (b->options & OPT_POUNCE_POPUP) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
69 c = gaim_find_conversation(name);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
70
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
71 if (c == NULL)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72 c = gaim_conversation_new(GAIM_CONV_IM, account, name);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73 else
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
74 gaim_conversation_set_account(c, account);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
75 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
76 if (b->options & OPT_POUNCE_NOTIFY) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
77 char tmp[1024];
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
78
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
79 /* I know the line below is really ugly. I only did it this way
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
80 * because I thought it'd be funny :-) */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
81
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82 g_snprintf(tmp, sizeof(tmp),
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83 (when & OPT_POUNCE_TYPING) ? _("%s has started typing to you") :
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
84 (when & OPT_POUNCE_SIGNON) ? _("%s has signed on") :
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
85 (when & OPT_POUNCE_UNIDLE) ? _("%s has returned from being idle") :
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
86 _("%s has returned from being away"), name);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
87
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88 do_error_dialog(tmp, NULL, GAIM_INFO);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90 if (b->options & OPT_POUNCE_SEND_IM) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91 if (strlen(b->message) > 0) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92 c = gaim_find_conversation(name);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
93
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94 if (c == NULL)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
95 c = gaim_conversation_new(GAIM_CONV_IM, account, name);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
96 else
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97 gaim_conversation_set_account(c, account);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
98
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99 gaim_conversation_write(c, NULL, b->message, -1,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100 WFLAG_SEND, time(NULL));
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102 serv_send_im(account->gc, name, b->message, -1, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105 if (b->options & OPT_POUNCE_COMMAND) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106 #ifndef _WIN32
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 int pid = fork();
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109 if (pid == 0) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110 char *args[4];
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 args[0] = "sh";
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 args[1] = "-c";
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113 args[2] = b->command;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 args[3] = NULL;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 execvp(args[0], args);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116 _exit(0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118 #else
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119 STARTUPINFO si;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
120 PROCESS_INFORMATION pi;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122 ZeroMemory( &si, sizeof(si) );
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123 si.cb = sizeof(si);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124 ZeroMemory( &pi, sizeof(pi) );
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126 CreateProcess( NULL, b->command, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi );
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127 CloseHandle( pi.hProcess );
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128 CloseHandle( pi.hThread );
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129 #endif /*_WIN32*/
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131 /* if (b->options & OPT_POUNCE_SOUND) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132 if (strlen(b->sound))
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133 play_file(b->sound);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 else
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135 play_sound(SND_POUNCE_DEFAULT);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136 }*/
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138 if (!(b->options & OPT_POUNCE_SAVE))
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
139 rem_bp(NULL, b);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
140
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
141 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
142 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
143 g_free(who);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
144 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
145
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
146 static void new_bp_callback(GtkWidget *w, struct buddy *b)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
147 {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148 if (b)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
149 show_new_bp(b->name, b->account->gc, b->idle, b->uc & UC_UNAVAILABLE, NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
150 else
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
151 show_new_bp(NULL, NULL, 0, 0, NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
152 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
153
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
154 static void edit_bp_callback(GtkWidget *w, struct buddy_pounce *b)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
155 {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
156 show_new_bp(NULL, NULL, 0, 0, b);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
157 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
158
4696
abec345c8c92 [gaim-migrate @ 5007]
Nathan Walp <nwalp@pidgin.im>
parents: 4690
diff changeset
159 static GtkTooltips *bp_tooltip = NULL;
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
160 void do_bp_menu()
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
161 {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
162 GtkWidget *menuitem, *mess, *messmenu;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
163 static GtkWidget *remmenu;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
164 GtkWidget *remitem;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
165 GtkWidget *sep;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
166 GList *l;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
167 struct buddy_pounce *b;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
168 GList *bp = buddy_pounces;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
169
4696
abec345c8c92 [gaim-migrate @ 5007]
Nathan Walp <nwalp@pidgin.im>
parents: 4690
diff changeset
170 /* Tooltip for editing bp's */
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
171 if(!bp_tooltip)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
172 bp_tooltip = gtk_tooltips_new();
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
173
4696
abec345c8c92 [gaim-migrate @ 5007]
Nathan Walp <nwalp@pidgin.im>
parents: 4690
diff changeset
174 l = gtk_container_get_children(GTK_CONTAINER(bpmenu));
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
175
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
176 while (l) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
177 gtk_widget_destroy(GTK_WIDGET(l->data));
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
178 l = l->next;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
179 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
181 remmenu = gtk_menu_new();
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
183 menuitem = gtk_menu_item_new_with_label(_("New Buddy Pounce"));
4696
abec345c8c92 [gaim-migrate @ 5007]
Nathan Walp <nwalp@pidgin.im>
parents: 4690
diff changeset
184 gtk_menu_shell_append(GTK_MENU_SHELL(bpmenu), menuitem);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185 gtk_widget_show(menuitem);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186 g_signal_connect(GTK_OBJECT(menuitem), "activate", G_CALLBACK(new_bp_callback), NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
189 while (bp) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
190
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191 b = (struct buddy_pounce *)bp->data;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
192 remitem = gtk_menu_item_new_with_label(b->name);
4696
abec345c8c92 [gaim-migrate @ 5007]
Nathan Walp <nwalp@pidgin.im>
parents: 4690
diff changeset
193 gtk_menu_shell_append(GTK_MENU_SHELL(remmenu), remitem);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
194 gtk_widget_show(remitem);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
195 g_signal_connect(GTK_OBJECT(remitem), "activate", G_CALLBACK(rem_bp), b);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
196
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197 bp = bp->next;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
198
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
199 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
200
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
201 menuitem = gtk_menu_item_new_with_label(_("Remove Buddy Pounce"));
4696
abec345c8c92 [gaim-migrate @ 5007]
Nathan Walp <nwalp@pidgin.im>
parents: 4690
diff changeset
202 gtk_menu_shell_append(GTK_MENU_SHELL(bpmenu), menuitem);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
203 gtk_widget_show(menuitem);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
204 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), remmenu);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
205 gtk_widget_show(remmenu);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
206
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
207 sep = gtk_hseparator_new();
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
208 menuitem = gtk_menu_item_new();
4696
abec345c8c92 [gaim-migrate @ 5007]
Nathan Walp <nwalp@pidgin.im>
parents: 4690
diff changeset
209 gtk_menu_shell_append(GTK_MENU_SHELL(bpmenu), menuitem);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
210 gtk_container_add(GTK_CONTAINER(menuitem), sep);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211 gtk_widget_set_sensitive(menuitem, FALSE);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
212 gtk_widget_show(menuitem);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213 gtk_widget_show(sep);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215 bp = buddy_pounces;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
217 while (bp) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
218
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219 b = (struct buddy_pounce *)bp->data;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
220
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
221 menuitem = gtk_menu_item_new_with_label(b->name);
4696
abec345c8c92 [gaim-migrate @ 5007]
Nathan Walp <nwalp@pidgin.im>
parents: 4690
diff changeset
222 gtk_menu_shell_append(GTK_MENU_SHELL(bpmenu), menuitem);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
223 messmenu = gtk_menu_new();
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
224 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), messmenu);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
225 gtk_widget_show(menuitem);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
226
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
227 if (strlen(b->message))
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
228 mess = gtk_menu_item_new_with_label(b->message);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
229 else
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
230 mess = gtk_menu_item_new_with_label(_("[no message]"));
4696
abec345c8c92 [gaim-migrate @ 5007]
Nathan Walp <nwalp@pidgin.im>
parents: 4690
diff changeset
231 gtk_menu_shell_append(GTK_MENU_SHELL(messmenu), mess);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
232 gtk_tooltips_set_tip(bp_tooltip, GTK_WIDGET(mess), _("[Click to edit]"), NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
233 gtk_widget_show(mess);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
234 g_signal_connect(GTK_OBJECT(mess), "activate", G_CALLBACK(edit_bp_callback), b);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
235 bp = bp->next;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
236
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
237 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
238
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
239 }
4696
abec345c8c92 [gaim-migrate @ 5007]
Nathan Walp <nwalp@pidgin.im>
parents: 4690
diff changeset
240
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
241 /*------------------------------------------------------------------------*/
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
242 /* The dialog for new buddy pounces */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
243 /*------------------------------------------------------------------------*/
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
244
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
245
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
246 void do_new_bp(GtkWidget *w, struct addbp *b)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
247 {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
248 struct buddy_pounce *bp;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
249
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
250 if (strlen(gtk_entry_get_text(GTK_ENTRY(b->nameentry))) == 0) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
251 do_error_dialog(_("Please enter a buddy to pounce."), NULL, GAIM_ERROR);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
252 return;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
253 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
254
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
255 if(!b->buddy_pounce)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
256 bp = g_new0(struct buddy_pounce, 1);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
257 else
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
258 bp = b->buddy_pounce;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
259
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
260
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
261 g_snprintf(bp->name, 80, "%s", gtk_entry_get_text(GTK_ENTRY(b->nameentry)));
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
262 g_snprintf(bp->message, 2048, "%s", gtk_entry_get_text(GTK_ENTRY(b->messentry)));
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
263 g_snprintf(bp->command, 2048, "%s", gtk_entry_get_text(GTK_ENTRY(b->commentry)));
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
264 g_snprintf(bp->sound, 2048, "%s", gtk_entry_get_text(GTK_ENTRY(b->soundentry)));
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
265 g_snprintf(bp->pouncer, 80, "%s", b->account->username);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
267 bp->protocol = b->account->protocol;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
268
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
269 bp->options = 0;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
271 if (GTK_TOGGLE_BUTTON(b->popupnotify)->active)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
272 bp->options |= OPT_POUNCE_NOTIFY;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
273
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
274 if (GTK_TOGGLE_BUTTON(b->openwindow)->active)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
275 bp->options |= OPT_POUNCE_POPUP;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
276
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
277 if (GTK_TOGGLE_BUTTON(b->sendim)->active)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
278 bp->options |= OPT_POUNCE_SEND_IM;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
279
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
280 if (GTK_TOGGLE_BUTTON(b->command)->active)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
281 bp->options |= OPT_POUNCE_COMMAND;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
282
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
283 if (GTK_TOGGLE_BUTTON(b->sound)->active)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
284 bp->options |= OPT_POUNCE_SOUND;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
285
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
286 if (GTK_TOGGLE_BUTTON(b->p_signon)->active)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
287 bp->options |= OPT_POUNCE_SIGNON;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
288
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
289 if (GTK_TOGGLE_BUTTON(b->p_unaway)->active)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
290 bp->options |= OPT_POUNCE_UNAWAY;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
291
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
292 if (GTK_TOGGLE_BUTTON(b->p_unidle)->active)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
293 bp->options |= OPT_POUNCE_UNIDLE;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
294
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
295 if (GTK_TOGGLE_BUTTON(b->p_typing)->active)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
296 bp->options |= OPT_POUNCE_TYPING;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
297
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
298 if (GTK_TOGGLE_BUTTON(b->save)->active)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
299 bp->options |= OPT_POUNCE_SAVE;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
300
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
301 if(!b->buddy_pounce)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
302 buddy_pounces = g_list_append(buddy_pounces, bp);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
303
4696
abec345c8c92 [gaim-migrate @ 5007]
Nathan Walp <nwalp@pidgin.im>
parents: 4690
diff changeset
304 do_bp_menu();
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
305
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
306 gtk_widget_destroy(b->window);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
307
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
308 save_prefs();
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
309 g_free(b);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
310 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
311
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
312 static void pounce_choose(GtkWidget *opt, struct addbp *b)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
313 {
4729
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4696
diff changeset
314 struct gaim_account *account = g_object_get_data(G_OBJECT(opt), "gaim_account");
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
315 b->account = account;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
316 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
317
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
318 static GtkWidget *pounce_user_menu(struct addbp *b, struct gaim_connection *gc)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
319 {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
320 GtkWidget *optmenu;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
321 GtkWidget *menu;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
322 GtkWidget *opt;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
323 GSList *u = gaim_accounts;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
324 struct gaim_account *account;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
325 struct prpl *p;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
326 int count = 0;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
327 int place = 0;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
328 char buf[2048];
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
329
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
330
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
331 optmenu = gtk_option_menu_new();
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
332
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
333 menu = gtk_menu_new();
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
334
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
335 while (u) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
336 account = (struct gaim_account *)u->data;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
337 p = (struct prpl *)find_prpl(account->protocol);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
338 g_snprintf(buf, sizeof buf, "%s (%s)", account->username, (p && p->name)?p->name:_("Unknown"));
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
339 opt = gtk_menu_item_new_with_label(buf);
4729
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4696
diff changeset
340 g_object_set_data(G_OBJECT(opt), "gaim_account", account);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
341 g_signal_connect(GTK_OBJECT(opt), "activate", G_CALLBACK(pounce_choose), b);
4690
e19f91053ad0 [gaim-migrate @ 5001]
Nathan Walp <nwalp@pidgin.im>
parents: 4687
diff changeset
342 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
343 gtk_widget_show(opt);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
344
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
345 if (b->account == account) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
346 gtk_menu_item_activate(GTK_MENU_ITEM(opt));
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
347 place = count;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
348 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
349
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
350 count++;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
351
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
352 u = u->next;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
353 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
354
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
355 gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
356 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), place);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
357
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
358 b->menu = optmenu;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
359
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
360 return optmenu;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
361 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
362
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
363
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
364 void show_new_bp(char *name, struct gaim_connection *gc, int idle, int away, struct buddy_pounce *edit_bp)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
365 {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
366 GtkWidget *label;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
367 GtkWidget *bbox;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
368 GtkWidget *vbox;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
369 GtkWidget *button;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
370 GtkWidget *frame;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
371 GtkWidget *table;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
372 GtkWidget *optmenu;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
373 GtkWidget *sep;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
374 GtkSizeGroup *sg;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
375
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
376 struct addbp *b = g_new0(struct addbp, 1);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
377
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
378 if(edit_bp) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
379 b->buddy_pounce = edit_bp;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
380 b->account = gaim_account_find(edit_bp->pouncer, edit_bp->protocol);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
381 } else {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
382 b->account = gc ? gc->account : gaim_accounts->data;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
383 b->buddy_pounce = NULL;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
384 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
385
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
386 GAIM_DIALOG(b->window);
4690
e19f91053ad0 [gaim-migrate @ 5001]
Nathan Walp <nwalp@pidgin.im>
parents: 4687
diff changeset
387 gtk_window_set_resizable(GTK_WINDOW(b->window), TRUE);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
388 gtk_window_set_role(GTK_WINDOW(b->window), "new_bp");
4772
6fe8008d6560 [gaim-migrate @ 5091]
Mark Doliner <mark@kingant.net>
parents: 4729
diff changeset
389 gtk_window_set_title(GTK_WINDOW(b->window), _("New Buddy Pounce"));
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
390 g_signal_connect(GTK_OBJECT(b->window), "destroy", G_CALLBACK(gtk_widget_destroy), b->window);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
391 gtk_widget_realize(b->window);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
392
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
393 vbox = gtk_vbox_new(FALSE, 5);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
394 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
395 gtk_container_add(GTK_CONTAINER(b->window), vbox);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
396 gtk_widget_show(vbox);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
397
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
398 /* <pounce type="who"> */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
399 frame = gtk_frame_new(_("Pounce Who"));
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
400 gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
401 gtk_widget_show(GTK_WIDGET(frame));
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
402
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
403 table = gtk_table_new(2, 2, FALSE);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
404 gtk_container_add(GTK_CONTAINER(frame), table);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
405 gtk_container_set_border_width(GTK_CONTAINER(table), 5);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
406 gtk_table_set_col_spacings(GTK_TABLE(table), 5);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
407 gtk_table_set_row_spacings(GTK_TABLE(table), 5);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
408 gtk_widget_show(table);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
409
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
410 label = gtk_label_new(_("Account"));
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
411 gtk_misc_set_alignment(GTK_MISC(label), 0, .5);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
412 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
413 gtk_widget_show(label);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
414
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
415 optmenu = pounce_user_menu(b, gc);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
416 gtk_table_attach(GTK_TABLE(table), optmenu, 1, 2, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
417 gtk_widget_show(optmenu);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
418
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
419 label = gtk_label_new(_("Buddy"));
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
420 gtk_misc_set_alignment(GTK_MISC(label), 0, .5);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
421 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
422 gtk_widget_show(label);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
423
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
424 b->nameentry = gtk_entry_new();
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
425 gtk_table_attach(GTK_TABLE(table), b->nameentry, 1, 2, 1, 2, GTK_FILL | GTK_EXPAND, 0, 0, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
426 if (name !=NULL)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
427 gtk_entry_set_text(GTK_ENTRY(b->nameentry), name);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
428 else if(edit_bp)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
429 gtk_entry_set_text(GTK_ENTRY(b->nameentry), edit_bp->name);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
430 gtk_window_set_focus(GTK_WINDOW(b->window), b->nameentry);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
431 gtk_widget_show(b->nameentry);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
432 /* </pounce type="who"> */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
433
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
434
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
435 /* <pounce type="when"> */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
436 frame = gtk_frame_new(_("Pounce When"));
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
437 gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
438 gtk_widget_show(GTK_WIDGET(frame));
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
439
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
440 table = gtk_table_new(2, 2, FALSE);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
441 gtk_container_add(GTK_CONTAINER(frame), table);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
442 gtk_container_set_border_width(GTK_CONTAINER(table), 5);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
443 gtk_table_set_col_spacings(GTK_TABLE(table), 5);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
444 gtk_widget_show(table);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
445
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
446 b->p_signon = gtk_check_button_new_with_label(_("Pounce on sign on"));
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
447 if(edit_bp)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
448 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->p_signon),
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
449 (edit_bp->options & OPT_POUNCE_SIGNON) ? TRUE : FALSE);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
450 else
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
451 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->p_signon), TRUE);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
452 gtk_table_attach(GTK_TABLE(table), b->p_signon, 0, 1, 0, 1, GTK_FILL, 0, 0, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
453 gtk_widget_show(b->p_signon);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
454
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
455 b->p_unaway = gtk_check_button_new_with_label(_("Pounce on return from away"));
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
456 if (away)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
457 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->p_unaway), TRUE);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
458 else if(edit_bp)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
459 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->p_unaway),
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
460 (edit_bp->options & OPT_POUNCE_UNAWAY) ? TRUE : FALSE);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
461 gtk_table_attach(GTK_TABLE(table), b->p_unaway, 1, 2, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
462 gtk_widget_show(b->p_unaway);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
463
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
464 b->p_unidle = gtk_check_button_new_with_label(_("Pounce on return from idle"));
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
465 if (idle)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
466 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->p_unidle), TRUE);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
467 else if(edit_bp)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
468 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->p_unidle),
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
469 (edit_bp->options & OPT_POUNCE_UNIDLE) ? TRUE : FALSE);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
470 gtk_table_attach(GTK_TABLE(table), b->p_unidle, 0, 1, 1, 2, GTK_FILL, 0, 0, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
471 gtk_widget_show(b->p_unidle);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
472
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
473 b->p_typing = gtk_check_button_new_with_label(_("Pounce when buddy is typing to you"));
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
474 if (edit_bp)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
475 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->p_typing),
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
476 (edit_bp->options & OPT_POUNCE_TYPING) ? TRUE : FALSE);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
477 gtk_table_attach(GTK_TABLE(table), b->p_typing,1,2,1,2, GTK_FILL | GTK_EXPAND, 0, 0, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
478 gtk_widget_show(b->p_typing);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
479
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
480 /* </pounce type="when"> */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
481
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
482 /* <pounce type="action"> */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
483 frame = gtk_frame_new(_("Pounce Action"));
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
484 gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
485 gtk_widget_show(GTK_WIDGET(frame));
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
486
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
487 table = gtk_table_new(4, 2, FALSE);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
488 gtk_container_add(GTK_CONTAINER(frame), table);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
489 gtk_container_set_border_width(GTK_CONTAINER(table), 5);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
490 gtk_table_set_col_spacings(GTK_TABLE(table), 5);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
491 gtk_table_set_row_spacings(GTK_TABLE(table), 5);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
492 gtk_widget_show(table);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
493
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
494 b->openwindow = gtk_check_button_new_with_label(_("Open IM Window"));
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
495 if(edit_bp)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
496 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->openwindow),
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
497 (edit_bp->options & OPT_POUNCE_POPUP) ? TRUE : FALSE);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
498 else
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
499 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->openwindow), FALSE);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
500 gtk_table_attach(GTK_TABLE(table), b->openwindow, 0, 1, 0, 1, GTK_FILL, 0, 0, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
501 gtk_widget_show(b->openwindow);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
502
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
503 b->popupnotify = gtk_check_button_new_with_label(_("Popup Notification"));
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
504 if(edit_bp)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
505 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->popupnotify),
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
506 (edit_bp->options & OPT_POUNCE_NOTIFY) ? TRUE : FALSE);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
507 else
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
508 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->popupnotify), FALSE);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
509 gtk_table_attach(GTK_TABLE(table), b->popupnotify, 1, 2, 0, 1, GTK_FILL, 0, 0, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
510 gtk_widget_show(b->popupnotify);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
511
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
512 b->sendim = gtk_check_button_new_with_label(_("Send Message"));
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
513 if(edit_bp)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
514 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->sendim),
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
515 (edit_bp->options & OPT_POUNCE_SEND_IM) ? TRUE : FALSE);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
516 else
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
517 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->sendim), TRUE);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
518 gtk_table_attach(GTK_TABLE(table), b->sendim, 0, 1, 1, 2, GTK_FILL, 0, 0, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
519 gtk_widget_show(b->sendim);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
520
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
521 b->messentry = gtk_entry_new();
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
522 gtk_table_attach(GTK_TABLE(table), b->messentry, 1, 2, 1, 2, GTK_FILL | GTK_EXPAND, 0, 0, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
523 g_signal_connect(GTK_OBJECT(b->messentry), "activate", G_CALLBACK(do_new_bp), b);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
524 if(edit_bp) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
525 gtk_widget_set_sensitive(GTK_WIDGET(b->messentry),
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
526 (edit_bp->options & OPT_POUNCE_SEND_IM) ? TRUE : FALSE);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
527 gtk_entry_set_text(GTK_ENTRY(b->messentry), edit_bp->message);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
528 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
529 gtk_widget_show(b->messentry);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
530
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
531 g_signal_connect(GTK_OBJECT(b->sendim), "clicked",
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
532 G_CALLBACK(gaim_gtk_toggle_sensitive), b->messentry);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
533
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
534 b->command = gtk_check_button_new_with_label(_("Execute command on pounce"));
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
535 gtk_table_attach(GTK_TABLE(table), b->command, 0, 1, 2, 3, GTK_FILL, 0, 0, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
536 if(edit_bp)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
537 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->command),
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
538 (edit_bp->options & OPT_POUNCE_COMMAND) ? TRUE : FALSE);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
539 else
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
540 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->command), FALSE);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
541 gtk_widget_show(b->command);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
542
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
543 b->commentry = gtk_entry_new();
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
544 gtk_table_attach(GTK_TABLE(table), b->commentry, 1, 2, 2, 3, GTK_FILL | GTK_EXPAND, 0, 0, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
545 g_signal_connect(GTK_OBJECT(b->commentry), "activate", G_CALLBACK(do_new_bp), b);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
546 if(edit_bp) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
547 gtk_widget_set_sensitive(GTK_WIDGET(b->commentry),
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
548 (edit_bp->options & OPT_POUNCE_COMMAND) ? TRUE : FALSE);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
549 gtk_entry_set_text(GTK_ENTRY(b->commentry), edit_bp->command);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
550 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
551 else
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
552 gtk_widget_set_sensitive(GTK_WIDGET(b->commentry), FALSE);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
553 gtk_widget_show(b->commentry);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
554 g_signal_connect(GTK_OBJECT(b->command), "clicked",
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
555 G_CALLBACK(gaim_gtk_toggle_sensitive), b->commentry);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
556
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
557 b->sound = gtk_check_button_new_with_label(_("Play sound on pounce"));
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
558 if(edit_bp)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
559 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->sound),
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
560 (edit_bp->options & OPT_POUNCE_SOUND) ? TRUE : FALSE);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
561 else
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
562 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->sound), FALSE);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
563 gtk_table_attach(GTK_TABLE(table), b->sound, 0, 1, 3, 4, GTK_FILL, 0, 0, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
564 gtk_widget_show(b->sound);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
565
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
566 b->soundentry = gtk_entry_new();
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
567 gtk_table_attach(GTK_TABLE(table), b->soundentry, 1, 2, 3, 4, GTK_FILL | GTK_EXPAND, 0, 0, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
568 g_signal_connect(GTK_OBJECT(b->soundentry), "activate", G_CALLBACK(do_new_bp), b);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
569 if(edit_bp) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
570 gtk_widget_set_sensitive(GTK_WIDGET(b->soundentry),
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
571 (edit_bp->options & OPT_POUNCE_SOUND) ? TRUE : FALSE);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
572 gtk_entry_set_text(GTK_ENTRY(b->soundentry), edit_bp->sound);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
573 } else
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
574 gtk_widget_set_sensitive(GTK_WIDGET(b->soundentry), FALSE);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
575 gtk_widget_show(b->soundentry);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
576 g_signal_connect(GTK_OBJECT(b->sound), "clicked",
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
577 G_CALLBACK(gaim_gtk_toggle_sensitive), b->soundentry);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
578 /* </pounce type="action"> */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
579
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
580 b->save = gtk_check_button_new_with_label(_("Save this pounce after activation"));
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
581 gtk_container_set_border_width(GTK_CONTAINER(b->save), 7);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
582 if(edit_bp)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
583 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->save),
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
584 (edit_bp->options & OPT_POUNCE_SAVE) ? TRUE : FALSE);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
585 else
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
586 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->save), FALSE);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
587 gtk_box_pack_start(GTK_BOX(vbox), b->save, FALSE, FALSE, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
588 gtk_widget_show(b->save);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
589
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
590 sep = gtk_hseparator_new();
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
591 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
592 gtk_widget_show(sep);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
593
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
594 bbox = gtk_hbox_new(FALSE, 5);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
595 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
596 gtk_widget_show(bbox);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
597
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
598 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
599
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
600 button = gaim_pixbuf_button_from_stock(_("_Save"), "gtk-execute", GAIM_BUTTON_HORIZONTAL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
601 gtk_size_group_add_widget(sg, button);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
602 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(do_new_bp), b);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
603 gtk_box_pack_end(GTK_BOX(bbox), button, FALSE, FALSE, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
604 gtk_widget_show(button);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
605
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
606 button = gaim_pixbuf_button_from_stock(_("C_ancel"), "gtk-cancel", GAIM_BUTTON_HORIZONTAL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
607 gtk_size_group_add_widget(sg, button);
4696
abec345c8c92 [gaim-migrate @ 5007]
Nathan Walp <nwalp@pidgin.im>
parents: 4690
diff changeset
608 g_signal_connect_swapped(GTK_OBJECT(button), "clicked", G_CALLBACK(gtk_widget_destroy), b->window);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
609 gtk_box_pack_end(GTK_BOX(bbox), button, FALSE, FALSE, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
610 gtk_widget_show(button);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
611
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
612
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
613 gtk_widget_show(b->window);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
614 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
615