annotate src/gtkpounce.c @ 5083:580c790bc042

[gaim-migrate @ 5437] I couldn't compile on Red Hat 9 without this. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Tue, 08 Apr 2003 14:31:19 +0000
parents abc8489b2e8f
children ab0f12de3718
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 /**
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 * @file gtkpounce.h GTK+ buddy pounce API
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 *
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4 * gaim
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 *
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6 * Copyright (C) 2003, Christian Hammond <chipx86@gnupdate.org>
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7 *
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 * (at your option) any later version.
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 *
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * GNU General Public License for more details.
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 *
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 *
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 */
5054
abc8489b2e8f [gaim-migrate @ 5404]
Nathan Walp <nwalp@pidgin.im>
parents: 5052
diff changeset
23 #include <unistd.h>
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24 #include "gaim.h"
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
25 #include "gtkpounce.h"
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
26 #include "gtklist.h"
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
27 #include "prpl.h"
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
28 #include "sound.h"
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
30 struct gaim_gtkpounce_dialog
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31 {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
32 /* Pounce data */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
33 struct gaim_pounce *pounce;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
34 struct gaim_account *account;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
35
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
36 /* The window */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
37 GtkWidget *window;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
38
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
39 /* Pounce Who */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
40 GtkWidget *account_menu;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
41 GtkWidget *buddy_entry;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
42
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
43 /* Pounce When */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
44 GtkWidget *signon;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45 GtkWidget *signoff;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
46 GtkWidget *away;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47 GtkWidget *away_return;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
48 GtkWidget *idle;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49 GtkWidget *idle_return;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
50 GtkWidget *typing;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
51 GtkWidget *stop_typing;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
53 /* Pounce Action */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
54 GtkWidget *open_win;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
55 GtkWidget *popup;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
56 GtkWidget *send_msg;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
57 GtkWidget *send_msg_entry;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
58 GtkWidget *exec_cmd;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
59 GtkWidget *exec_cmd_entry;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
60 GtkWidget *play_sound;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
61 GtkWidget *play_sound_entry;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
62
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
63 GtkWidget *save_pounce;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
64 };
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
65
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
66 /**************************************************************************
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
67 * Callbacks
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
68 **************************************************************************/
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69 static gint
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70 delete_win_cb(GtkWidget *w, GdkEventAny *e,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
71 struct gaim_gtkpounce_dialog *dialog)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72 {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
73 gtk_widget_destroy(dialog->window);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
74 g_free(dialog);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
75
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
76 return TRUE;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
77 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
78
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
79 static void
5052
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
80 delete_cb(GtkWidget *w, struct gaim_gtkpounce_dialog *dialog)
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
81 {
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
82 gaim_pounce_destroy(dialog->pounce);
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
83
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
84 delete_win_cb(NULL, NULL, dialog);
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
85 }
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
86
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
87 static void
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
88 cancel_cb(GtkWidget *w, struct gaim_gtkpounce_dialog *dialog)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
89 {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
90 delete_win_cb(NULL, NULL, dialog);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
91 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
92
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
93
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
94 static void
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
95 save_pounce_cb(GtkWidget *w, struct gaim_gtkpounce_dialog *dialog)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
96 {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
97 const char *name;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
98 const char *message, *command, *sound;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
99 struct gaim_buddy_list *blist;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
100 struct gaim_gtk_buddy_list *gtkblist;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
101 GaimPounceEvent events = GAIM_POUNCE_NONE;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
102 GaimGtkPounceAction actions = GAIM_GTKPOUNCE_NONE;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
103 gboolean save;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
104
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
105 name = gtk_entry_get_text(GTK_ENTRY(dialog->buddy_entry));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
106
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
107 if (*name == '\0') {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
108 do_error_dialog(_("Please enter a buddy to pounce."), NULL, GAIM_ERROR);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
109 return;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
110 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
111
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
112 /* Events */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
113 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->signon)))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
114 events |= GAIM_POUNCE_SIGNON;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
115
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
116 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->signoff)))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
117 events |= GAIM_POUNCE_SIGNOFF;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
118
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
119 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->away)))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
120 events |= GAIM_POUNCE_AWAY;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
121
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
122 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->away_return)))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
123 events |= GAIM_POUNCE_AWAY_RETURN;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
124
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
125 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->idle)))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
126 events |= GAIM_POUNCE_IDLE;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
127
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
128 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->idle_return)))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
129 events |= GAIM_POUNCE_IDLE_RETURN;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
130
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
131 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->typing)))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
132 events |= GAIM_POUNCE_TYPING;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
133
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
134 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->stop_typing)))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
135 events |= GAIM_POUNCE_TYPING_STOPPED;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
136
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
137
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
138 /* Actions */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
139 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->open_win)))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
140 actions |= GAIM_GTKPOUNCE_OPEN_WIN;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
141
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
142 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->popup)))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
143 actions |= GAIM_GTKPOUNCE_POPUP;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
144
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
145 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->send_msg)))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
146 actions |= GAIM_GTKPOUNCE_SEND_MSG;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
147
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
148 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->exec_cmd)))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
149 actions |= GAIM_GTKPOUNCE_EXEC_CMD;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
150
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
151 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->play_sound)))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
152 actions |= GAIM_GTKPOUNCE_PLAY_SOUND;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
153
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
154 save = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->save_pounce));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
155
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
156 /* Data fields */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
157 message = gtk_entry_get_text(GTK_ENTRY(dialog->send_msg_entry));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
158 command = gtk_entry_get_text(GTK_ENTRY(dialog->exec_cmd_entry));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
159 sound = gtk_entry_get_text(GTK_ENTRY(dialog->play_sound_entry));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
160
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
161 if (*message == '\0') message = NULL;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
162 if (*command == '\0') command = NULL;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
163 if (*sound == '\0') sound = NULL;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
164
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
165 if (dialog->pounce == NULL)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
166 {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
167 gaim_gtkpounce_new(dialog->account, name, events, actions,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
168 message, command, sound, save);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
169 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
170 else
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
171 {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
172 struct gaim_gtkpounce_data *pounce_data;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
173
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
174 gaim_pounce_set_events(dialog->pounce, events);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
175 gaim_pounce_set_pouncer(dialog->pounce, dialog->account);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
176 gaim_pounce_set_pouncee(dialog->pounce, name);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
177
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
178 pounce_data = GAIM_GTKPOUNCE(dialog->pounce);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
179
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
180 if (pounce_data->message != NULL) g_free(pounce_data->message);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
181 if (pounce_data->command != NULL) g_free(pounce_data->command);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
182 if (pounce_data->sound != NULL) g_free(pounce_data->sound);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
183
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
184 pounce_data->message = (message == NULL ? NULL : g_strdup(message));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
185 pounce_data->command = (command == NULL ? NULL : g_strdup(command));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
186 pounce_data->sound = (sound == NULL ? NULL : g_strdup(sound));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
187
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
188 pounce_data->actions = actions;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
189 pounce_data->save = save;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
190 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
191
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
192 delete_win_cb(NULL, NULL, dialog);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
193
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
194 /* Rebuild the pounce menu */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
195 blist = gaim_get_blist();
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
196
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
197 if (GAIM_IS_GTK_BLIST(blist))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
198 {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
199 gtkblist = GAIM_GTK_BLIST(blist);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
200
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
201 gaim_gtkpounce_menu_build(gtkblist->bpmenu);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
202 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
203
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
204 save_prefs();
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
205 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
206
5054
abc8489b2e8f [gaim-migrate @ 5404]
Nathan Walp <nwalp@pidgin.im>
parents: 5052
diff changeset
207 static void
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
208 pounce_choose_cb(GtkWidget *item, struct gaim_gtkpounce_dialog *dialog)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
209 {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
210 dialog->account = g_object_get_data(G_OBJECT(item), "user_data");
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
211 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
212
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
213 static GtkWidget *
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
214 pounce_user_menu(struct gaim_gtkpounce_dialog *dialog)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
215 {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
216 struct gaim_account *account;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
217 struct prpl *prpl;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
218 GtkWidget *opt_menu;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
219 GtkWidget *menu;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
220 GtkWidget *item;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
221 GSList *l;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
222 char buf[2048];
5054
abc8489b2e8f [gaim-migrate @ 5404]
Nathan Walp <nwalp@pidgin.im>
parents: 5052
diff changeset
223 int count, place = 0;
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
224
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
225 opt_menu = gtk_option_menu_new();
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
226 menu = gtk_menu_new();
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
227
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
228 for (l = gaim_accounts, count = 0; l != NULL; l = l->next, count++) {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
229 account = (struct gaim_account *)l->data;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
230
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
231 prpl = (struct prpl *)find_prpl(account->protocol);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
232
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
233 g_snprintf(buf, sizeof(buf), "%s (%s)", account->username,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
234 (prpl && prpl->name) ? prpl->name : _("Unknown"));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
235
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
236 item = gtk_menu_item_new_with_label(buf);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
237 g_object_set_data(G_OBJECT(item), "user_data", account);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
238
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
239 g_signal_connect(G_OBJECT(item), "activate",
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
240 G_CALLBACK(pounce_choose_cb), dialog);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
241
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
242 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
243 gtk_widget_show(item);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
244
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
245 if (dialog->account == account) {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
246 gtk_menu_item_activate(GTK_MENU_ITEM(item));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
247 place = count;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
248 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
249 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
250
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
251 gtk_option_menu_set_menu(GTK_OPTION_MENU(opt_menu), menu);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
252 gtk_option_menu_set_history(GTK_OPTION_MENU(opt_menu), place);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
253
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
254 return opt_menu;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
255 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
256
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
257 static void
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
258 pounce_cb(struct gaim_pounce *pounce, GaimPounceEvent events, void *data)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
259 {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
260 struct gaim_conversation *conv;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
261 struct gaim_account *account;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
262 struct gaim_gtkpounce_data *pounce_data;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
263 const char *pouncee;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
264
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
265 pounce_data = (struct gaim_gtkpounce_data *)data;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
266 pouncee = gaim_pounce_get_pouncee(pounce);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
267 account = gaim_pounce_get_pouncer(pounce);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
268
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
269 if (pounce_data->actions & GAIM_GTKPOUNCE_OPEN_WIN) {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
270 conv = gaim_find_conversation(pouncee);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
271
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
272 if (conv == NULL)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
273 conv = gaim_conversation_new(GAIM_CONV_IM, account, pouncee);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
274 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
275
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
276 if (pounce_data->actions & GAIM_GTKPOUNCE_POPUP) {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
277 char tmp[1024];
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
278
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
279 g_snprintf(tmp, sizeof(tmp),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
280 (events & GAIM_POUNCE_TYPING) ? _("%s has started typing to you") :
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
281 (events & GAIM_POUNCE_SIGNON) ? _("%s has signed on") :
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
282 (events & GAIM_POUNCE_IDLE_RETURN) ? _("%s has returned from being idle") :
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
283 (events & GAIM_POUNCE_AWAY_RETURN) ? _("%s has returned from being away") :
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
284 (events & GAIM_POUNCE_TYPING_STOPPED) ? _("%s has stopped typing to you") :
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
285 (events & GAIM_POUNCE_SIGNOFF) ? _("%s has signed off") :
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
286 (events & GAIM_POUNCE_IDLE) ? _("%s has become idle") :
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
287 (events & GAIM_POUNCE_AWAY) ? _("%s has gone away.") :
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
288 _("Unknown pounce event. Please report this!"),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
289 pouncee);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
290
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
291 do_error_dialog(tmp, NULL, GAIM_INFO);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
292 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
293
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
294 if (pounce_data->actions & GAIM_GTKPOUNCE_SEND_MSG &&
5051
b3d9195777bb [gaim-migrate @ 5400]
Christian Hammond <chipx86@chipx86.com>
parents: 5032
diff changeset
295 pounce_data->message != NULL) {
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
296
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
297 conv = gaim_find_conversation(pouncee);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
298
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
299 if (conv == NULL)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
300 conv = gaim_conversation_new(GAIM_CONV_IM, account, pouncee);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
301
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
302 gaim_conversation_write(conv, NULL, pounce_data->message, -1,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
303 WFLAG_SEND, time(NULL));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
304
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
305 serv_send_im(account->gc, (char *)pouncee, pounce_data->message, -1, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
306 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
307
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
308 if (pounce_data->actions & GAIM_GTKPOUNCE_EXEC_CMD &&
5051
b3d9195777bb [gaim-migrate @ 5400]
Christian Hammond <chipx86@chipx86.com>
parents: 5032
diff changeset
309 pounce_data->command != NULL) {
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
310 #ifndef _WIN32
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
311 int pid = fork();
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
312
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
313 if (pid == 0) {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
314 char *args[4];
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
315
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
316 args[0] = "sh";
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
317 args[1] = "-c";
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
318 args[2] = pounce_data->command;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
319 args[3] = NULL;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
320
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
321 execvp(args[0], args);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
322
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
323 _exit(0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
324 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
325 #endif /* _WIN32 */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
326 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
327
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
328 if (pounce_data->actions & GAIM_GTKPOUNCE_PLAY_SOUND) {
5051
b3d9195777bb [gaim-migrate @ 5400]
Christian Hammond <chipx86@chipx86.com>
parents: 5032
diff changeset
329 if (pounce_data->sound != NULL)
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
330 gaim_sound_play_file(pounce_data->sound);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
331 else
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
332 gaim_sound_play_event(GAIM_SOUND_POUNCE_DEFAULT);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
333 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
334
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
335 if (!pounce_data->save)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
336 gaim_pounce_destroy(pounce);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
337 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
338
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
339 static void
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
340 free_pounce(void *data)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
341 {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
342 struct gaim_gtkpounce_data *pounce_data;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
343 struct gaim_buddy_list *blist;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
344 struct gaim_gtk_buddy_list *gtkblist;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
345
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
346 pounce_data = (struct gaim_gtkpounce_data *)data;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
347
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
348 if (pounce_data->message != NULL) g_free(pounce_data->message);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
349 if (pounce_data->command != NULL) g_free(pounce_data->command);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
350 if (pounce_data->sound != NULL) g_free(pounce_data->sound);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
351
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
352 g_free(data);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
353
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
354 /* Rebuild the pounce menu */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
355 blist = gaim_get_blist();
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
356
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
357 if (GAIM_IS_GTK_BLIST(blist))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
358 {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
359 gtkblist = GAIM_GTK_BLIST(blist);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
360
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
361 gaim_gtkpounce_menu_build(gtkblist->bpmenu);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
362 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
363
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
364 save_prefs();
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
365 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
366
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
367 struct gaim_pounce *
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
368 gaim_gtkpounce_new(struct gaim_account *pouncer, const char *pouncee,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
369 GaimPounceEvent events, GaimGtkPounceAction actions,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
370 const char *message, const char *command,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
371 const char *sound, gboolean save)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
372 {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
373 struct gaim_gtkpounce_data *data;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
374
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
375 data = g_new0(struct gaim_gtkpounce_data, 1);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
376
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
377 data->actions = actions;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
378
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
379 if (message != NULL) data->message = g_strdup(message);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
380 if (command != NULL) data->command = g_strdup(command);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
381 if (sound != NULL) data->sound = g_strdup(sound);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
382
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
383 data->save = save;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
384
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
385 return gaim_pounce_new(pouncer, pouncee, events, pounce_cb, data,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
386 free_pounce);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
387 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
388
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
389 void
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
390 gaim_gtkpounce_dialog_show(struct buddy *buddy,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
391 struct gaim_pounce *cur_pounce)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
392 {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
393 struct gaim_gtkpounce_dialog *dialog;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
394 GtkWidget *window;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
395 GtkWidget *label;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
396 GtkWidget *bbox;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
397 GtkWidget *vbox1, *vbox2;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
398 GtkWidget *hbox;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
399 GtkWidget *button;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
400 GtkWidget *frame;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
401 GtkWidget *table;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
402 GtkWidget *sep;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
403 GtkSizeGroup *sg;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
404
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
405 dialog = g_new0(struct gaim_gtkpounce_dialog, 1);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
406
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
407 if (cur_pounce != NULL) {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
408 dialog->pounce = cur_pounce;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
409 dialog->account = gaim_pounce_get_pouncer(cur_pounce);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
410 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
411 else if (buddy != NULL) {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
412 dialog->pounce = NULL;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
413 dialog->account = buddy->account;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
414 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
415 else {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
416 dialog->pounce = NULL;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
417 dialog->account = gaim_accounts->data;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
418 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
419
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
420 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
421
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
422 /* Create the window. */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
423 dialog->window = window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
424 gtk_window_set_type_hint(GTK_WINDOW(window), GDK_WINDOW_TYPE_HINT_DIALOG);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
425 gtk_window_set_role(GTK_WINDOW(window), "buddy_pounce");
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
426 gtk_window_set_resizable(GTK_WINDOW(window), FALSE);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
427 gtk_window_set_title(GTK_WINDOW(window),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
428 (cur_pounce == NULL
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
429 ? _("New Buddy Pounce") : _("Edit Buddy Pounce")));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
430
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
431 gtk_container_set_border_width(GTK_CONTAINER(window), 12);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
432 gtk_widget_realize(window);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
433
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
434 g_signal_connect(G_OBJECT(window), "delete_event",
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
435 G_CALLBACK(delete_win_cb), dialog);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
436
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
437 /* Create the parent vbox for everything. */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
438 vbox1 = gtk_vbox_new(FALSE, 12);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
439 gtk_container_add(GTK_CONTAINER(window), vbox1);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
440 gtk_widget_show(vbox1);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
441
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
442 /* Create the vbox that will contain all the prefs stuff. */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
443 vbox2 = gtk_vbox_new(FALSE, 18);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
444 gtk_box_pack_start(GTK_BOX(vbox1), vbox2, TRUE, TRUE, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
445
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
446 /* Create the "Pounce Who" frame. */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
447 frame = make_frame(vbox2, _("Pounce Who"));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
448
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
449 /* Account: */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
450 hbox = gtk_hbox_new(FALSE, 6);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
451 gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
452 gtk_widget_show(hbox);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
453
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
454 label = gtk_label_new_with_mnemonic(_("_Account:"));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
455 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
456 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
457 gtk_widget_show(label);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
458 gtk_size_group_add_widget(sg, label);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
459
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
460 dialog->account_menu = pounce_user_menu(dialog);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
461 gtk_box_pack_start(GTK_BOX(hbox), dialog->account_menu, FALSE, FALSE, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
462 gtk_widget_show(dialog->account_menu);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
463
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
464 /* Buddy: */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
465 hbox = gtk_hbox_new(FALSE, 6);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
466 gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
467 gtk_widget_show(hbox);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
468
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
469 label = gtk_label_new_with_mnemonic(_("_Buddy Name:"));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
470 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
471 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
472 gtk_widget_show(label);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
473 gtk_size_group_add_widget(sg, label);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
474
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
475 dialog->buddy_entry = gtk_entry_new();
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
476 gtk_box_pack_start(GTK_BOX(hbox), dialog->buddy_entry, TRUE, TRUE, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
477 gtk_widget_show(dialog->buddy_entry);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
478
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
479 if (cur_pounce != NULL) {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
480 gtk_entry_set_text(GTK_ENTRY(dialog->buddy_entry),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
481 gaim_pounce_get_pouncee(cur_pounce));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
482 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
483 else if (buddy != NULL) {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
484 gtk_entry_set_text(GTK_ENTRY(dialog->buddy_entry), buddy->name);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
485 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
486
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
487 /* Create the "Pounce When" frame. */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
488 frame = make_frame(vbox2, _("Pounce When"));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
489
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
490 table = gtk_table_new(2, 4, FALSE);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
491 gtk_container_add(GTK_CONTAINER(frame), table);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
492 gtk_table_set_col_spacings(GTK_TABLE(table), 12);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
493 gtk_widget_show(table);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
494
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
495 dialog->signon =
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
496 gtk_check_button_new_with_label(_("Sign on"));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
497 dialog->signoff =
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
498 gtk_check_button_new_with_label(_("Sign off"));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
499 dialog->away =
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
500 gtk_check_button_new_with_label(_("Away"));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
501 dialog->away_return =
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
502 gtk_check_button_new_with_label(_("Return from away"));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
503 dialog->idle =
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
504 gtk_check_button_new_with_label(_("Idle"));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
505 dialog->idle_return =
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
506 gtk_check_button_new_with_label(_("Return from idle"));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
507 dialog->typing =
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
508 gtk_check_button_new_with_label(_("Buddy starts typing"));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
509 dialog->stop_typing =
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
510 gtk_check_button_new_with_label(_("Buddy stops typing"));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
511
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
512 gtk_table_attach(GTK_TABLE(table), dialog->signon, 0, 1, 0, 1,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
513 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
514 gtk_table_attach(GTK_TABLE(table), dialog->signoff, 1, 2, 0, 1,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
515 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
516 gtk_table_attach(GTK_TABLE(table), dialog->away, 0, 1, 1, 2,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
517 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
518 gtk_table_attach(GTK_TABLE(table), dialog->away_return, 1, 2, 1, 2,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
519 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
520 gtk_table_attach(GTK_TABLE(table), dialog->idle, 0, 1, 2, 3,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
521 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
522 gtk_table_attach(GTK_TABLE(table), dialog->idle_return, 1, 2, 2, 3,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
523 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
524 gtk_table_attach(GTK_TABLE(table), dialog->typing, 0, 1, 3, 4,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
525 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
526 gtk_table_attach(GTK_TABLE(table), dialog->stop_typing, 1, 2, 3, 4,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
527 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
528
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
529 gtk_widget_show(dialog->signon);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
530 gtk_widget_show(dialog->signoff);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
531 gtk_widget_show(dialog->away);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
532 gtk_widget_show(dialog->away_return);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
533 gtk_widget_show(dialog->idle);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
534 gtk_widget_show(dialog->idle_return);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
535 gtk_widget_show(dialog->typing);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
536 gtk_widget_show(dialog->stop_typing);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
537
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
538 /* Create the "Pounce Action" frame. */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
539 frame = make_frame(vbox2, _("Pounce Action"));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
540
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
541 table = gtk_table_new(2, 5, FALSE);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
542 gtk_container_add(GTK_CONTAINER(frame), table);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
543 gtk_table_set_col_spacings(GTK_TABLE(table), 12);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
544 gtk_widget_show(table);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
545
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
546 dialog->open_win = gtk_check_button_new_with_label(_("Open an IM window"));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
547 dialog->popup = gtk_check_button_new_with_label(_("Popup notification"));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
548 dialog->send_msg = gtk_check_button_new_with_label(_("Send a message"));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
549 dialog->exec_cmd = gtk_check_button_new_with_label(_("Execute a command"));
5051
b3d9195777bb [gaim-migrate @ 5400]
Christian Hammond <chipx86@chipx86.com>
parents: 5032
diff changeset
550 dialog->play_sound = gtk_check_button_new_with_label(_("Play a sound"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
551
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
552 dialog->send_msg_entry = gtk_entry_new();
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
553 dialog->exec_cmd_entry = gtk_entry_new();
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
554 dialog->play_sound_entry = gtk_entry_new();
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
555
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
556 gtk_widget_set_sensitive(dialog->send_msg_entry, FALSE);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
557 gtk_widget_set_sensitive(dialog->exec_cmd_entry, FALSE);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
558 gtk_widget_set_sensitive(dialog->play_sound_entry, FALSE);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
559
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
560 gtk_table_attach(GTK_TABLE(table), dialog->open_win, 0, 1, 0, 1,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
561 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
562 gtk_table_attach(GTK_TABLE(table), dialog->popup, 0, 1, 1, 2,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
563 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
564 gtk_table_attach(GTK_TABLE(table), dialog->send_msg, 0, 1, 2, 3,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
565 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
566 gtk_table_attach(GTK_TABLE(table), dialog->send_msg_entry, 1, 2, 2, 3,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
567 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
568 gtk_table_attach(GTK_TABLE(table), dialog->exec_cmd, 0, 1, 3, 4,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
569 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
570 gtk_table_attach(GTK_TABLE(table), dialog->exec_cmd_entry, 1, 2, 3, 4,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
571 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
572 gtk_table_attach(GTK_TABLE(table), dialog->play_sound, 0, 1, 4, 5,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
573 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
574 gtk_table_attach(GTK_TABLE(table), dialog->play_sound_entry, 1, 2, 4, 5,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
575 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
576
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
577 gtk_widget_show(dialog->open_win);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
578 gtk_widget_show(dialog->popup);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
579 gtk_widget_show(dialog->send_msg);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
580 gtk_widget_show(dialog->send_msg_entry);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
581 gtk_widget_show(dialog->exec_cmd);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
582 gtk_widget_show(dialog->exec_cmd_entry);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
583 gtk_widget_show(dialog->play_sound);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
584 gtk_widget_show(dialog->play_sound_entry);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
585
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
586 g_signal_connect(G_OBJECT(dialog->send_msg), "clicked",
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
587 G_CALLBACK(gaim_gtk_toggle_sensitive),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
588 dialog->send_msg_entry);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
589 g_signal_connect(G_OBJECT(dialog->exec_cmd), "clicked",
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
590 G_CALLBACK(gaim_gtk_toggle_sensitive),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
591 dialog->exec_cmd_entry);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
592 g_signal_connect(G_OBJECT(dialog->play_sound), "clicked",
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
593 G_CALLBACK(gaim_gtk_toggle_sensitive),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
594 dialog->play_sound_entry);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
595
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
596 g_signal_connect(G_OBJECT(dialog->send_msg_entry), "activate",
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
597 G_CALLBACK(save_pounce_cb), dialog);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
598 g_signal_connect(G_OBJECT(dialog->exec_cmd_entry), "activate",
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
599 G_CALLBACK(save_pounce_cb), dialog);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
600 g_signal_connect(G_OBJECT(dialog->play_sound_entry), "activate",
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
601 G_CALLBACK(save_pounce_cb), dialog);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
602
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
603 /* Now the last part, where we have the Save checkbox */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
604 dialog->save_pounce = gtk_check_button_new_with_mnemonic(
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
605 _("_Save this pounce after activation"));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
606
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
607 gtk_box_pack_start(GTK_BOX(vbox2), dialog->save_pounce, FALSE, FALSE, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
608
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
609 /* Separator... */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
610 sep = gtk_hseparator_new();
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
611 gtk_box_pack_start(GTK_BOX(vbox1), sep, FALSE, FALSE, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
612 gtk_widget_show(sep);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
613
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
614 /* Now the button box! */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
615 bbox = gtk_hbutton_box_new();
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
616 gtk_box_set_spacing(GTK_BOX(bbox), 6);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
617 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
618 gtk_box_pack_end(GTK_BOX(vbox1), bbox, FALSE, FALSE, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
619 gtk_widget_show(bbox);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
620
5052
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
621 /* Delete button */
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
622 button = gtk_button_new_from_stock(GTK_STOCK_DELETE);
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
623 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
624 gtk_widget_show(button);
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
625
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
626 g_signal_connect(G_OBJECT(button), "clicked",
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
627 G_CALLBACK(delete_cb), dialog);
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
628
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
629 /* Cancel button */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
630 button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
631 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
632 gtk_widget_show(button);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
633
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
634 g_signal_connect(G_OBJECT(button), "clicked",
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
635 G_CALLBACK(cancel_cb), dialog);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
636
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
637 /* OK button */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
638 button = gtk_button_new_from_stock(GTK_STOCK_OK);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
639 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
640 gtk_widget_show(button);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
641
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
642 g_signal_connect(G_OBJECT(button), "clicked",
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
643 G_CALLBACK(save_pounce_cb), dialog);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
644
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
645 /* Set the values of stuff. */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
646 if (cur_pounce != NULL) {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
647 GaimPounceEvent events;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
648 GaimGtkPounceAction actions;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
649 struct gaim_gtkpounce_data *pounce_data;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
650
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
651 pounce_data = GAIM_GTKPOUNCE(cur_pounce);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
652 events = gaim_pounce_get_events(cur_pounce);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
653 actions = pounce_data->actions;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
654
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
655 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->signon),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
656 (events & GAIM_POUNCE_SIGNON));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
657 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->signoff),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
658 (events & GAIM_POUNCE_SIGNOFF));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
659 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->away),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
660 (events & GAIM_POUNCE_AWAY));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
661 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->away_return),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
662 (events & GAIM_POUNCE_AWAY_RETURN));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
663 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->idle),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
664 (events & GAIM_POUNCE_IDLE));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
665 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->idle_return),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
666 (events & GAIM_POUNCE_IDLE_RETURN));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
667 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->typing),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
668 (events & GAIM_POUNCE_TYPING));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
669 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->stop_typing),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
670 (events & GAIM_POUNCE_TYPING_STOPPED));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
671
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
672 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->open_win),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
673 (actions & GAIM_GTKPOUNCE_OPEN_WIN));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
674 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->popup),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
675 (actions & GAIM_GTKPOUNCE_POPUP));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
676 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->send_msg),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
677 (actions & GAIM_GTKPOUNCE_SEND_MSG));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
678 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->exec_cmd),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
679 (actions & GAIM_GTKPOUNCE_EXEC_CMD));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
680 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->play_sound),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
681 (actions & GAIM_GTKPOUNCE_PLAY_SOUND));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
682
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
683 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->save_pounce),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
684 pounce_data->save);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
685
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
686 gtk_entry_set_text(GTK_ENTRY(dialog->send_msg_entry),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
687 pounce_data->message);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
688 gtk_entry_set_text(GTK_ENTRY(dialog->exec_cmd_entry),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
689 pounce_data->command);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
690 gtk_entry_set_text(GTK_ENTRY(dialog->play_sound_entry),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
691 pounce_data->sound);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
692 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
693 else {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
694 /* Set some defaults */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
695 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->send_msg), TRUE);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
696 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->signon), TRUE);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
697 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
698
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
699 gtk_widget_show_all(vbox2);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
700 gtk_widget_show(window);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
701 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
702
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
703 static void
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
704 new_pounce_cb(GtkWidget *w, struct buddy *b)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
705 {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
706 gaim_gtkpounce_dialog_show(b, NULL);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
707 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
708
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
709 static void
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
710 edit_pounce_cb(GtkWidget *w, struct gaim_pounce *pounce)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
711 {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
712 struct buddy *buddy;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
713
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
714 buddy = gaim_find_buddy(gaim_pounce_get_pouncer(pounce),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
715 gaim_pounce_get_pouncee(pounce));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
716
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
717 gaim_gtkpounce_dialog_show(buddy, pounce);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
718 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
719
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
720 void
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
721 gaim_gtkpounce_menu_build(GtkWidget *menu)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
722 {
5054
abc8489b2e8f [gaim-migrate @ 5404]
Nathan Walp <nwalp@pidgin.im>
parents: 5052
diff changeset
723 GtkWidget *remmenu, *item;
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
724 GList *l;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
725 GList *bp;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
726 struct gaim_pounce *pounce;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
727 const char *buddy;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
728
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
729 for (l = gtk_container_get_children(GTK_CONTAINER(menu));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
730 l != NULL;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
731 l = l->next) {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
732
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
733 gtk_widget_destroy(GTK_WIDGET(l->data));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
734 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
735
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
736 /* "New Buddy Pounce" */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
737 item = gtk_menu_item_new_with_label(_("New Buddy Pounce"));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
738 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
739 gtk_widget_show(item);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
740 g_signal_connect(G_OBJECT(item), "activate",
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
741 G_CALLBACK(new_pounce_cb), NULL);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
742
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
743 /* "Remove Buddy Pounce" */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
744 item = gtk_menu_item_new_with_label(_("Remove Buddy Pounce"));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
745 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
746
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
747 /* "Remove Buddy Pounce" menu */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
748 remmenu = gtk_menu_new();
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
749
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
750 for (bp = gaim_get_pounces(); bp != NULL; bp = bp->next) {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
751 pounce = (struct gaim_pounce *)bp->data;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
752 buddy = gaim_pounce_get_pouncee(pounce);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
753
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
754 item = gtk_menu_item_new_with_label(buddy);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
755 gtk_menu_shell_append(GTK_MENU_SHELL(remmenu), item);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
756 gtk_widget_show(item);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
757
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
758 g_signal_connect(G_OBJECT(item), "activate",
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
759 G_CALLBACK(edit_pounce_cb), pounce);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
760 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
761
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
762 gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), remmenu);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
763 gtk_widget_show(remmenu);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
764 gtk_widget_show(item);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
765
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
766 /* Separator */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
767 item = gtk_separator_menu_item_new();
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
768 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
769 gtk_widget_show(item);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
770
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
771 /* Pounces */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
772 for (bp = gaim_get_pounces(); bp != NULL; bp = bp->next) {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
773 struct gaim_gtkpounce_data *pounce_data;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
774
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
775 pounce = (struct gaim_pounce *)bp->data;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
776 buddy = gaim_pounce_get_pouncee(pounce);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
777
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
778 pounce_data = GAIM_GTKPOUNCE(pounce);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
779
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
780 item = gtk_menu_item_new_with_label(buddy);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
781 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
782 gtk_widget_show(item);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
783
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
784 g_signal_connect(G_OBJECT(item), "activate",
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
785 G_CALLBACK(edit_pounce_cb), pounce);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
786 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
787 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
788